~jamesh/thumbnailer/qml-module-package-name

« back to all changes in this revision

Viewing changes to plugins/Ubuntu/Thumbnailer.0.1/albumartgenerator.h

  • Committer: James Henstridge
  • Date: 2015-09-14 07:03:06 UTC
  • mto: This revision was merged to the branch mainline in revision 271.
  • Revision ID: james@jamesh.id.au-20150914070306-dpn05n210rwpfmir
Use a single instances of Thumbnailer and RateLimiter shared between the 
three ImageProvider classes.

Also use the default D-Bus connection rather than creating three new 
ones.  We are making our D-Bus calls from the main thread and performing 
them asynchronously, so should be safe to use a shared connection.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
class AlbumArtGenerator : public QQuickAsyncImageProvider
39
39
{
40
40
private:
41
 
    std::unique_ptr<unity::thumbnailer::qt::Thumbnailer> thumbnailer;
42
 
    unity::thumbnailer::RateLimiter backlog_limiter;
 
41
    std::shared_ptr<unity::thumbnailer::qt::Thumbnailer> thumbnailer;
 
42
    std::shared_ptr<unity::thumbnailer::RateLimiter> backlog_limiter;
43
43
 
44
44
public:
45
 
    AlbumArtGenerator();
 
45
    AlbumArtGenerator(std::shared_ptr<unity::thumbnailer::qt::Thumbnailer> thumbnailer,
 
46
                      std::shared_ptr<unity::thumbnailer::RateLimiter> backlog_limiter);
46
47
    QQuickImageResponse* requestImageResponse(const QString& id, const QSize& requestedSize) override;
47
48
};
48
49