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

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

Issue 8523037: base::Bind migrations in chrome/renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // A RendererNetPredictor instance is maintained for each RenderThread. 5 // A RendererNetPredictor instance is maintained for each RenderThread.
6 // URL strings are typically added to the embedded queue during rendering. 6 // URL strings are typically added to the embedded queue during rendering.
7 // The first addition to the queue (transitioning from empty to having 7 // The first addition to the queue (transitioning from empty to having
8 // some names) causes a processing task to be added to the Renderer Thread. 8 // some names) causes a processing task to be added to the Renderer Thread.
9 // The processing task gathers all buffered names, and send them via IPC 9 // The processing task gathers all buffered names, and send them via IPC
10 // to the browser, so that DNS lookups can be performed before the user attempts 10 // to the browser, so that DNS lookups can be performed before the user attempts
11 // to traverse a link. 11 // to traverse a link.
12 // This class removed some duplicates, and discards numeric IP addresss 12 // This class removed some duplicates, and discards numeric IP addresss
13 // (which wouldn't looked up in DNS anyway). 13 // (which wouldn't looked up in DNS anyway).
14 // To limit the time during the processing task (and avoid stalling the Render 14 // To limit the time during the processing task (and avoid stalling the Render
15 // thread), several limits are placed on how much of the queue to process. 15 // thread), several limits are placed on how much of the queue to process.
16 // If the processing task is not able to completely empty the queue, it 16 // If the processing task is not able to completely empty the queue, it
17 // schedules a future continuation of the task, and keeps the map of already 17 // schedules a future continuation of the task, and keeps the map of already
18 // sent names. If the entire queue is processed, then the list of "sent names" 18 // sent names. If the entire queue is processed, then the list of "sent names"
19 // is cleared so that future gatherings might again pass along the same names. 19 // is cleared so that future gatherings might again pass along the same names.
20 20
21 #ifndef CHROME_RENDERER_NET_RENDERER_NET_PREDICTOR_H_ 21 #ifndef CHROME_RENDERER_NET_RENDERER_NET_PREDICTOR_H_
22 #define CHROME_RENDERER_NET_RENDERER_NET_PREDICTOR_H_ 22 #define CHROME_RENDERER_NET_RENDERER_NET_PREDICTOR_H_
23 #pragma once 23 #pragma once
24 24
25 #include <map> 25 #include <map>
26 #include <string> 26 #include <string>
27 27
28 #include "base/basictypes.h" 28 #include "base/basictypes.h"
29 #include "base/memory/weak_ptr.h"
29 #include "base/task.h" 30 #include "base/task.h"
30 #include "chrome/renderer/net/predictor_queue.h" 31 #include "chrome/renderer/net/predictor_queue.h"
31 32
32 class RendererNetPredictor { 33 class RendererNetPredictor {
33 public: 34 public:
34 RendererNetPredictor(); 35 RendererNetPredictor();
35 ~RendererNetPredictor(); 36 ~RendererNetPredictor();
36 37
37 // Push a name into the queue to be resolved. 38 // Push a name into the queue to be resolved.
38 void Resolve(const char* name, size_t length); 39 void Resolve(const char* name, size_t length);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // Cache a tally of the count of names that haven't yet been sent 90 // Cache a tally of the count of names that haven't yet been sent
90 // for DNS pre-fetching. Note that we *could* recalculate this 91 // for DNS pre-fetching. Note that we *could* recalculate this
91 // count by iterating over domain_map_, looking for even values. 92 // count by iterating over domain_map_, looking for even values.
92 size_t new_name_count_; 93 size_t new_name_count_;
93 94
94 // We have some metrics to examine performance. We might use 95 // We have some metrics to examine performance. We might use
95 // these metrics to modify buffer counts etc. some day. 96 // these metrics to modify buffer counts etc. some day.
96 int buffer_full_discard_count_; 97 int buffer_full_discard_count_;
97 int numeric_ip_discard_count_; 98 int numeric_ip_discard_count_;
98 99
99 ScopedRunnableMethodFactory<RendererNetPredictor> renderer_predictor_factory_; 100 base::WeakPtrFactory<RendererNetPredictor> weak_factory_;
100 101
101 DISALLOW_COPY_AND_ASSIGN(RendererNetPredictor); 102 DISALLOW_COPY_AND_ASSIGN(RendererNetPredictor);
102 }; // class RendererNetPredictor 103 }; // class RendererNetPredictor
103 104
104 #endif // CHROME_RENDERER_NET_RENDERER_NET_PREDICTOR_H_ 105 #endif // CHROME_RENDERER_NET_RENDERER_NET_PREDICTOR_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/user_script_idle_scheduler.cc ('k') | chrome/renderer/net/renderer_net_predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698