Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: chrome/browser/bitmap_fetcher/bitmap_fetcher.h

Issue 931993002: Make image_decoder a Leaky LazyInstance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ImageDecoder->RemoveDelegate Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ 5 #ifndef CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_
6 #define CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ 6 #define CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h" 9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h"
10 #include "chrome/browser/image_decoder.h" 10 #include "chrome/browser/image_decoder.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // expected total size of the response (or -1 if not determined). 52 // expected total size of the response (or -1 if not determined).
53 void OnURLFetchDownloadProgress(const net::URLFetcher* source, 53 void OnURLFetchDownloadProgress(const net::URLFetcher* source,
54 int64 current, 54 int64 current,
55 int64 total) override; 55 int64 total) override;
56 56
57 // Methods inherited from ImageDecoder::Delegate 57 // Methods inherited from ImageDecoder::Delegate
58 58
59 // Called when image is decoded. |decoder| is used to identify the image in 59 // Called when image is decoded. |decoder| is used to identify the image in
60 // case of decoding several images simultaneously. This will not be called 60 // case of decoding several images simultaneously. This will not be called
61 // on the UI thread. 61 // on the UI thread.
62 void OnImageDecoded(const ImageDecoder* decoder, 62 void OnImageDecoded(const SkBitmap& decoded_image) override;
63 const SkBitmap& decoded_image) override;
64 63
65 // Called when decoding image failed. 64 // Called when decoding image failed.
66 void OnDecodeImageFailed(const ImageDecoder* decoder) override; 65 void OnDecodeImageFailed() override;
67 66
68 private: 67 private:
69 // Alerts the delegate that a failure occurred. 68 // Alerts the delegate that a failure occurred.
70 void ReportFailure(); 69 void ReportFailure();
71 70
72 scoped_ptr<net::URLFetcher> url_fetcher_; 71 scoped_ptr<net::URLFetcher> url_fetcher_;
73 scoped_refptr<ImageDecoder> image_decoder_;
74 const GURL url_; 72 const GURL url_;
75 BitmapFetcherDelegate* const delegate_; 73 BitmapFetcherDelegate* const delegate_;
76 74
77 DISALLOW_COPY_AND_ASSIGN(BitmapFetcher); 75 DISALLOW_COPY_AND_ASSIGN(BitmapFetcher);
78 }; 76 };
79 77
80 } // namespace chrome 78 } // namespace chrome
81 79
82 #endif // CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ 80 #endif // CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698