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

Unified Diff: chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc

Issue 2682263002: Network traffic annotation added to chrome::BitmapFetcher. (Closed)
Patch Set: Unittests added. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc
diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc
index f1a2f9a77b4eda6476baa8c08234b79465cd77cb..5f881955f1f6f78ca6402590f4828cc45306964f 100644
--- a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc
+++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc
@@ -83,7 +83,8 @@ void BitmapFetcherService::CancelRequest(int request_id) {
BitmapFetcherService::RequestId BitmapFetcherService::RequestImage(
const GURL& url,
- Observer* observer) {
+ Observer* observer,
+ const net::NetworkTrafficAnnotationTag& traffic_annotation) {
// Create a new request, assigning next available request ID.
++current_request_id_;
if (current_request_id_ == REQUEST_ID_INVALID)
@@ -111,22 +112,26 @@ BitmapFetcherService::RequestId BitmapFetcherService::RequestImage(
return REQUEST_ID_INVALID;
// Make sure there's a fetcher for this URL and attach to request.
- const chrome::BitmapFetcher* fetcher = EnsureFetcherForUrl(url);
+ const chrome::BitmapFetcher* fetcher = EnsureFetcherForUrl(
+ url, traffic_annotation);
request->set_fetcher(fetcher);
requests_.push_back(request.release());
return requests_.back()->request_id();
}
-void BitmapFetcherService::Prefetch(const GURL& url) {
+void BitmapFetcherService::Prefetch(
+ const GURL& url,
+ const net::NetworkTrafficAnnotationTag& traffic_annotation) {
if (url.is_valid())
- EnsureFetcherForUrl(url);
+ EnsureFetcherForUrl(url, traffic_annotation);
}
std::unique_ptr<chrome::BitmapFetcher> BitmapFetcherService::CreateFetcher(
- const GURL& url) {
+ const GURL& url,
+ const net::NetworkTrafficAnnotationTag& traffic_annotation) {
std::unique_ptr<chrome::BitmapFetcher> new_fetcher(
- new chrome::BitmapFetcher(url, this));
+ new chrome::BitmapFetcher(url, this, traffic_annotation));
new_fetcher->Init(
content::BrowserContext::GetDefaultStoragePartition(context_)->
@@ -139,12 +144,14 @@ std::unique_ptr<chrome::BitmapFetcher> BitmapFetcherService::CreateFetcher(
}
const chrome::BitmapFetcher* BitmapFetcherService::EnsureFetcherForUrl(
- const GURL& url) {
+ const GURL& url,
+ const net::NetworkTrafficAnnotationTag& traffic_annotation) {
const chrome::BitmapFetcher* fetcher = FindFetcherForUrl(url);
if (fetcher)
return fetcher;
- std::unique_ptr<chrome::BitmapFetcher> new_fetcher = CreateFetcher(url);
+ std::unique_ptr<chrome::BitmapFetcher> new_fetcher = CreateFetcher(
+ url, traffic_annotation);
active_fetchers_.push_back(std::move(new_fetcher));
return active_fetchers_.back().get();
}

Powered by Google App Engine
This is Rietveld 408576698