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

Side by Side Diff: components/precache/content/precache_manager.cc

Issue 2037523002: Select precache resources based on field trial experiment group (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments, added more test Created 4 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 | components/precache/core/precache_fetcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/precache/content/precache_manager.h" 5 #include "components/precache/content/precache_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "components/history/core/browser/history_service.h" 17 #include "components/history/core/browser/history_service.h"
18 #include "components/precache/core/precache_database.h" 18 #include "components/precache/core/precache_database.h"
19 #include "components/precache/core/precache_switches.h" 19 #include "components/precache/core/precache_switches.h"
20 #include "components/precache/core/proto/unfinished_work.pb.h" 20 #include "components/precache/core/proto/unfinished_work.pb.h"
21 #include "components/prefs/pref_service.h" 21 #include "components/prefs/pref_service.h"
22 #include "components/sync_driver/sync_service.h" 22 #include "components/sync_driver/sync_service.h"
23 #include "components/variations/metrics_util.h"
23 #include "components/variations/variations_associated_data.h" 24 #include "components/variations/variations_associated_data.h"
24 #include "content/public/browser/browser_context.h" 25 #include "content/public/browser/browser_context.h"
25 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/storage_partition.h" 27 #include "content/public/browser/storage_partition.h"
27 #include "net/base/network_change_notifier.h" 28 #include "net/base/network_change_notifier.h"
28 29
29 using content::BrowserThread; 30 using content::BrowserThread;
30 31
31 namespace { 32 namespace {
32 33
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 309 }
309 310
310 void PrecacheManager::InitializeAndStartFetcher() { 311 void PrecacheManager::InitializeAndStartFetcher() {
311 if (!is_precaching_) { 312 if (!is_precaching_) {
312 // Don't start precaching if it was canceled while waiting for the list of 313 // Don't start precaching if it was canceled while waiting for the list of
313 // hosts. 314 // hosts.
314 return; 315 return;
315 } 316 }
316 // Start precaching. 317 // Start precaching.
317 precache_fetcher_.reset(new PrecacheFetcher( 318 precache_fetcher_.reset(new PrecacheFetcher(
318 content::BrowserContext::GetDefaultStoragePartition(browser_context_)-> 319 content::BrowserContext::GetDefaultStoragePartition(browser_context_)
319 GetURLRequestContext(), 320 ->GetURLRequestContext(),
320 GURL(variations::GetVariationParamValue( 321 GURL(variations::GetVariationParamValue(kPrecacheFieldTrialName,
321 kPrecacheFieldTrialName, kConfigURLParam)), 322 kConfigURLParam)),
322 variations::GetVariationParamValue( 323 variations::GetVariationParamValue(kPrecacheFieldTrialName,
323 kPrecacheFieldTrialName, kManifestURLPrefixParam), 324 kManifestURLPrefixParam),
324 std::move(unfinished_work_), 325 std::move(unfinished_work_),
326 metrics::HashName(
327 base::FieldTrialList::FindFullName(kPrecacheFieldTrialName)),
325 this)); 328 this));
326 precache_fetcher_->Start(); 329 precache_fetcher_->Start();
327 } 330 }
328 331
329 void PrecacheManager::OnHostsReceivedThenDone( 332 void PrecacheManager::OnHostsReceivedThenDone(
330 const history::TopHostsList& host_counts) { 333 const history::TopHostsList& host_counts) {
331 OnDone(); 334 OnDone();
332 } 335 }
333 336
334 } // namespace precache 337 } // namespace precache
OLDNEW
« no previous file with comments | « no previous file | components/precache/core/precache_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698