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

Side by Side Diff: chrome/browser/metrics/variations/variations_service.cc

Issue 271853004: Merge NetworkTimeNotifier to NetworkTimeTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/network_time/network_time_service.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/metrics/variations/variations_service.h" 5 #include "chrome/browser/metrics/variations/variations_service.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/build_time.h" 9 #include "base/build_time.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 const base::TimeDelta latency = 492 const base::TimeDelta latency =
493 base::TimeTicks::Now() - last_request_started_time_; 493 base::TimeTicks::Now() - last_request_started_time_;
494 494
495 base::Time response_date; 495 base::Time response_date;
496 if (response_code == net::HTTP_OK || 496 if (response_code == net::HTTP_OK ||
497 response_code == net::HTTP_NOT_MODIFIED) { 497 response_code == net::HTTP_NOT_MODIFIED) {
498 bool success = request->GetResponseHeaders()->GetDateValue(&response_date); 498 bool success = request->GetResponseHeaders()->GetDateValue(&response_date);
499 DCHECK(success || response_date.is_null()); 499 DCHECK(success || response_date.is_null());
500 500
501 if (!response_date.is_null()) { 501 if (!response_date.is_null()) {
502 NetworkTimeTracker::BuildNotifierUpdateCallback().Run( 502 g_browser_process->network_time_tracker()->UpdateNetworkTime(
503 response_date, 503 response_date,
504 base::TimeDelta::FromMilliseconds(kServerTimeResolutionMs), 504 base::TimeDelta::FromMilliseconds(kServerTimeResolutionMs),
505 latency); 505 latency,
506 base::TimeTicks::Now());
506 } 507 }
507 } 508 }
508 509
509 if (response_code != net::HTTP_OK) { 510 if (response_code != net::HTTP_OK) {
510 DVLOG(1) << "Variations server request returned non-HTTP_OK response code: " 511 DVLOG(1) << "Variations server request returned non-HTTP_OK response code: "
511 << response_code; 512 << response_code;
512 if (response_code == net::HTTP_NOT_MODIFIED) { 513 if (response_code == net::HTTP_NOT_MODIFIED) {
513 RecordLastFetchTime(); 514 RecordLastFetchTime();
514 // Update the seed date value in local state (used for expiry check on 515 // Update the seed date value in local state (used for expiry check on
515 // next start up), since 304 is a successful response. 516 // next start up), since 304 is a successful response.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 548
548 void VariationsService::RecordLastFetchTime() { 549 void VariationsService::RecordLastFetchTime() {
549 // local_state_ is NULL in tests, so check it first. 550 // local_state_ is NULL in tests, so check it first.
550 if (local_state_) { 551 if (local_state_) {
551 local_state_->SetInt64(prefs::kVariationsLastFetchTime, 552 local_state_->SetInt64(prefs::kVariationsLastFetchTime,
552 base::Time::Now().ToInternalValue()); 553 base::Time::Now().ToInternalValue());
553 } 554 }
554 } 555 }
555 556
556 } // namespace chrome_variations 557 } // namespace chrome_variations
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/network_time/network_time_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698