~michihenning/thumbnailer/no-tmp-file

« back to all changes in this revision

Viewing changes to plugins/Ubuntu/Thumbnailer.0.1/thumbnailgenerator.cpp

  • Committer: Tarmac
  • Author(s): Michi Henning
  • Date: 2015-10-14 05:11:41 UTC
  • mfrom: (278.4.20 qt-rate-limiter)
  • Revision ID: tarmac-20151014051141-kyem0nctbyjgrczs
Moved rate limiter from QML to Qt side.
Fixed bug in libthumbnailer-qt that caused the state of completed request to not be released.
Changed stress test to test the rate limiting via Qt.

Approved by PS Jenkins bot, James Henstridge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
namespace qml
59
59
{
60
60
 
61
 
ThumbnailGenerator::ThumbnailGenerator(std::shared_ptr<unity::thumbnailer::qt::Thumbnailer> const& thumbnailer,
62
 
                                       std::shared_ptr<unity::thumbnailer::RateLimiter> const& backlog_limiter)
 
61
ThumbnailGenerator::ThumbnailGenerator(std::shared_ptr<unity::thumbnailer::qt::Thumbnailer> const& thumbnailer)
63
62
    : QQuickAsyncImageProvider()
64
63
    , thumbnailer(thumbnailer)
65
 
    , backlog_limiter(backlog_limiter)
66
64
{
67
65
}
68
66
 
88
86
     * is the only way around the issue for now. */
89
87
    QString src_path = QUrl(id).path();
90
88
 
91
 
    // Schedule dbus call
92
 
    auto job = [this, src_path, size]
93
 
    {
94
 
        return thumbnailer->getThumbnail(src_path, size);
95
 
    };
96
 
    return new ThumbnailerImageResponse(size, default_image_based_on_mime(id), backlog_limiter.get(), job);
 
89
    auto request = thumbnailer->getThumbnail(src_path, size);
 
90
    return new ThumbnailerImageResponse(size, default_image_based_on_mime(id), request);
97
91
}
98
92
 
99
93
}  // namespace qml