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

Side by Side Diff: net/http/http_server_properties_manager.cc

Issue 667473003: QUIC - Android - small experiment to flush http_server_properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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 "net/http/http_server_properties_manager.h" 5 #include "net/http/http_server_properties_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 namespace { 20 namespace {
21 21
22 // Time to wait before starting an update the http_server_properties_impl_ cache 22 // Time to wait before starting an update the http_server_properties_impl_ cache
23 // from preferences. Scheduling another update during this period will reset the 23 // from preferences. Scheduling another update during this period will reset the
24 // timer. 24 // timer.
25 const int64 kUpdateCacheDelayMs = 1000; 25 const int64 kUpdateCacheDelayMs = 1000;
26 26
27 // Time to wait before starting an update the preferences from the 27 // Time to wait before starting an update the preferences from the
28 // http_server_properties_impl_ cache. Scheduling another update during this 28 // http_server_properties_impl_ cache. Scheduling another update during this
29 // period will reset the timer. 29 // period will reset the timer.
30 // TODO(rtenneti): Remove OS_ANDROID ifdef after testing if flushing of
31 // AlternateProtocolHosts to disk in 500ms helps with QUIC's 0RTT or not.
32 #if defined(OS_ANDROID)
33 const int64 kUpdatePrefsDelayMs = 500;
34 #else
30 const int64 kUpdatePrefsDelayMs = 5000; 35 const int64 kUpdatePrefsDelayMs = 5000;
36 #endif
31 37
32 // "version" 0 indicates, http_server_properties doesn't have "version" 38 // "version" 0 indicates, http_server_properties doesn't have "version"
33 // property. 39 // property.
34 const int kMissingVersion = 0; 40 const int kMissingVersion = 0;
35 41
36 // The version number of persisted http_server_properties. 42 // The version number of persisted http_server_properties.
37 const int kVersionNumber = 3; 43 const int kVersionNumber = 3;
38 44
39 typedef std::vector<std::string> StringVector; 45 typedef std::vector<std::string> StringVector;
40 46
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 completion.Run(); 825 completion.Run();
820 } 826 }
821 827
822 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { 828 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() {
823 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); 829 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread());
824 if (!setting_prefs_) 830 if (!setting_prefs_)
825 ScheduleUpdateCacheOnPrefThread(); 831 ScheduleUpdateCacheOnPrefThread();
826 } 832 }
827 833
828 } // namespace net 834 } // namespace net
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