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

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

Issue 322233003: Remove an unnecessary SkBitmap copy on BitmapFetcher::OnImageDecoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/bitmap_fetcher.h" 5 #include "chrome/browser/bitmap_fetcher.h"
6 6
7 #include "content/public/browser/browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
8 #include "net/url_request/url_fetcher.h" 8 #include "net/url_request/url_fetcher.h"
9 #include "net/url_request/url_request_context_getter.h" 9 #include "net/url_request/url_request_context_getter.h"
10 #include "net/url_request/url_request_status.h" 10 #include "net/url_request/url_request_status.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 void BitmapFetcher::OnURLFetchDownloadProgress(const net::URLFetcher* source, 60 void BitmapFetcher::OnURLFetchDownloadProgress(const net::URLFetcher* source,
61 int64 current, 61 int64 current,
62 int64 total) { 62 int64 total) {
63 // Do nothing here. 63 // Do nothing here.
64 } 64 }
65 65
66 // Methods inherited from ImageDecoder::Delegate. 66 // Methods inherited from ImageDecoder::Delegate.
67 67
68 void BitmapFetcher::OnImageDecoded(const ImageDecoder* decoder, 68 void BitmapFetcher::OnImageDecoded(const ImageDecoder* decoder,
69 const SkBitmap& decoded_image) { 69 const SkBitmap& decoded_image) {
70 // Make a copy of the bitmap which we pass back to the UI thread.
71 scoped_ptr<SkBitmap> bitmap(new SkBitmap());
72 decoded_image.deepCopyTo(bitmap.get());
73
74 // Report success. 70 // Report success.
75 delegate_->OnFetchComplete(url_, bitmap.get()); 71 delegate_->OnFetchComplete(url_, &decoded_image);
76 } 72 }
77 73
78 void BitmapFetcher::OnDecodeImageFailed(const ImageDecoder* decoder) { 74 void BitmapFetcher::OnDecodeImageFailed(const ImageDecoder* decoder) {
79 ReportFailure(); 75 ReportFailure();
80 } 76 }
81 77
82 void BitmapFetcher::ReportFailure() { 78 void BitmapFetcher::ReportFailure() {
83 delegate_->OnFetchComplete(url_, NULL); 79 delegate_->OnFetchComplete(url_, NULL);
84 } 80 }
85 81
86 } // namespace chrome 82 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698