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

Side by Side Diff: chrome/renderer/net/renderer_net_predictor.cc

Issue 9233018: Convert use of int ms to TimeDelta in files owned by brettw. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase onto master. Created 8 years, 11 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // See header file for description of RendererNetPredictor class 5 // See header file for description of RendererNetPredictor class
6 6
7 #include "chrome/renderer/net/renderer_net_predictor.h" 7 #include "chrome/renderer/net/renderer_net_predictor.h"
8 8
9 #include <ctype.h> 9 #include <ctype.h>
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 DnsQueue::PushResult result = c_string_queue_.Push(name, length); 50 DnsQueue::PushResult result = c_string_queue_.Push(name, length);
51 if (DnsQueue::SUCCESSFUL_PUSH == result) { 51 if (DnsQueue::SUCCESSFUL_PUSH == result) {
52 if (1 == c_string_queue_.Size()) { 52 if (1 == c_string_queue_.Size()) {
53 DCHECK_EQ(old_size, 0u); 53 DCHECK_EQ(old_size, 0u);
54 if (0 != old_size) 54 if (0 != old_size)
55 return; // Overkill safety net: Don't send too many InvokeLater's. 55 return; // Overkill safety net: Don't send too many InvokeLater's.
56 weak_factory_.InvalidateWeakPtrs(); 56 weak_factory_.InvalidateWeakPtrs();
57 RenderThread::Get()->GetMessageLoop()->PostDelayedTask( 57 RenderThread::Get()->GetMessageLoop()->PostDelayedTask(
58 FROM_HERE, base::Bind(&RendererNetPredictor::SubmitHostnames, 58 FROM_HERE, base::Bind(&RendererNetPredictor::SubmitHostnames,
59 weak_factory_.GetWeakPtr()), 59 weak_factory_.GetWeakPtr()),
60 10); 60 base::TimeDelta::FromMilliseconds(10));
61 } 61 }
62 return; 62 return;
63 } 63 }
64 if (DnsQueue::OVERFLOW_PUSH == result) { 64 if (DnsQueue::OVERFLOW_PUSH == result) {
65 ++buffer_full_discard_count_; 65 ++buffer_full_discard_count_;
66 return; 66 return;
67 } 67 }
68 DCHECK(DnsQueue::REDUNDANT_PUSH == result); 68 DCHECK(DnsQueue::REDUNDANT_PUSH == result);
69 } 69 }
70 70
(...skipping 14 matching lines...) Expand all
85 85
86 // Don't overload the browser DNS lookup facility, or take too long here, 86 // Don't overload the browser DNS lookup facility, or take too long here,
87 // by only sending off kMAX_SUBMISSION_PER_TASK names to the Browser. 87 // by only sending off kMAX_SUBMISSION_PER_TASK names to the Browser.
88 // This will help to avoid overloads when a page has a TON of links. 88 // This will help to avoid overloads when a page has a TON of links.
89 DnsPrefetchNames(kMAX_SUBMISSION_PER_TASK); 89 DnsPrefetchNames(kMAX_SUBMISSION_PER_TASK);
90 if (new_name_count_ > 0 || 0 < c_string_queue_.Size()) { 90 if (new_name_count_ > 0 || 0 < c_string_queue_.Size()) {
91 weak_factory_.InvalidateWeakPtrs(); 91 weak_factory_.InvalidateWeakPtrs();
92 RenderThread::Get()->GetMessageLoop()->PostDelayedTask( 92 RenderThread::Get()->GetMessageLoop()->PostDelayedTask(
93 FROM_HERE, base::Bind(&RendererNetPredictor::SubmitHostnames, 93 FROM_HERE, base::Bind(&RendererNetPredictor::SubmitHostnames,
94 weak_factory_.GetWeakPtr()), 94 weak_factory_.GetWeakPtr()),
95 10); 95 base::TimeDelta::FromMilliseconds(10));
96 } else { 96 } else {
97 // TODO(JAR): Should we only clear the map when we navigate, or reload? 97 // TODO(JAR): Should we only clear the map when we navigate, or reload?
98 domain_map_.clear(); 98 domain_map_.clear();
99 } 99 }
100 } 100 }
101 101
102 // Pull some hostnames from the queue, and add them to our map. 102 // Pull some hostnames from the queue, and add them to our map.
103 void RendererNetPredictor::ExtractBufferedNames(size_t size_goal) { 103 void RendererNetPredictor::ExtractBufferedNames(size_t size_goal) {
104 size_t count(0); // Number of entries to find (0 means find all). 104 size_t count(0); // Number of entries to find (0 means find all).
105 if (size_goal > 0) { 105 if (size_goal > 0) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // address. 154 // address.
155 bool RendererNetPredictor::is_numeric_ip(const char* name, size_t length) { 155 bool RendererNetPredictor::is_numeric_ip(const char* name, size_t length) {
156 // Scan for a character outside our lookup list. 156 // Scan for a character outside our lookup list.
157 while (length-- > 0) { 157 while (length-- > 0) {
158 if (!isdigit(*name) && '.' != *name) 158 if (!isdigit(*name) && '.' != *name)
159 return false; 159 return false;
160 ++name; 160 ++name;
161 } 161 }
162 return true; 162 return true;
163 } 163 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/user_script_idle_scheduler.cc ('k') | chrome/renderer/translate_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698