OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_RENDERER_RENDER_THREAD_H_ | 5 #ifndef CHROME_RENDERER_RENDER_THREAD_H_ |
6 #define CHROME_RENDERER_RENDER_THREAD_H_ | 6 #define CHROME_RENDERER_RENDER_THREAD_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gfx/native_widget_types.h" | 10 #include "base/gfx/native_widget_types.h" |
11 #include "base/shared_memory.h" | 11 #include "base/shared_memory.h" |
12 #include "base/task.h" | 12 #include "base/task.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "chrome/common/child_thread.h" | 14 #include "chrome/common/child_thread.h" |
| 15 #include "chrome/renderer/renderer_histogram_snapshots.h" |
15 | 16 |
16 class FilePath; | 17 class FilePath; |
17 class NotificationService; | 18 class NotificationService; |
18 class RenderDnsMaster; | 19 class RenderDnsMaster; |
| 20 class RendererHistogram; |
19 class SkBitmap; | 21 class SkBitmap; |
20 class UserScriptSlave; | 22 class UserScriptSlave; |
21 class VisitedLinkSlave; | 23 class VisitedLinkSlave; |
22 struct ModalDialogEvent; | 24 struct ModalDialogEvent; |
23 struct WebPreferences; | 25 struct WebPreferences; |
24 | 26 |
25 // The RenderThreadBase is the minimal interface that a RenderView/Widget | 27 // The RenderThreadBase is the minimal interface that a RenderView/Widget |
26 // expects from a render thread. The interface basically abstracts a way to send | 28 // expects from a render thread. The interface basically abstracts a way to send |
27 // and receive messages. | 29 // and receive messages. |
28 class RenderThreadBase { | 30 class RenderThreadBase { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 81 |
80 // Gets the VisitedLinkSlave instance for this thread | 82 // Gets the VisitedLinkSlave instance for this thread |
81 VisitedLinkSlave* visited_link_slave() const { return visited_link_slave_; } | 83 VisitedLinkSlave* visited_link_slave() const { return visited_link_slave_; } |
82 | 84 |
83 // Gets the UserScriptSlave instance for this thread | 85 // Gets the UserScriptSlave instance for this thread |
84 UserScriptSlave* user_script_slave() const { return user_script_slave_; } | 86 UserScriptSlave* user_script_slave() const { return user_script_slave_; } |
85 | 87 |
86 // Do DNS prefetch resolution of a hostname. | 88 // Do DNS prefetch resolution of a hostname. |
87 void Resolve(const char* name, size_t length); | 89 void Resolve(const char* name, size_t length); |
88 | 90 |
| 91 // Send all the Histogram data to browser. |
| 92 void SendHistograms(); |
| 93 |
89 // Invokes InformHostOfCacheStats after a short delay. Used to move this | 94 // Invokes InformHostOfCacheStats after a short delay. Used to move this |
90 // bookkeeping operation off the critical latency path. | 95 // bookkeeping operation off the critical latency path. |
91 void InformHostOfCacheStatsLater(); | 96 void InformHostOfCacheStatsLater(); |
92 | 97 |
93 private: | 98 private: |
94 virtual void OnControlMessageReceived(const IPC::Message& msg); | 99 virtual void OnControlMessageReceived(const IPC::Message& msg); |
95 | 100 |
96 // Called by the thread base class | 101 // Called by the thread base class |
97 virtual void Init(); | 102 virtual void Init(); |
98 virtual void CleanUp(); | 103 virtual void CleanUp(); |
99 | 104 |
100 void OnUpdateVisitedLinks(base::SharedMemoryHandle table); | 105 void OnUpdateVisitedLinks(base::SharedMemoryHandle table); |
101 void OnUpdateUserScripts(base::SharedMemoryHandle table); | 106 void OnUpdateUserScripts(base::SharedMemoryHandle table); |
102 | 107 |
103 void OnPluginMessage(const FilePath& plugin_path, | 108 void OnPluginMessage(const FilePath& plugin_path, |
104 const std::vector<uint8>& data); | 109 const std::vector<uint8>& data); |
105 void OnSetNextPageID(int32 next_page_id); | 110 void OnSetNextPageID(int32 next_page_id); |
106 void OnCreateNewView(gfx::NativeViewId parent_hwnd, | 111 void OnCreateNewView(gfx::NativeViewId parent_hwnd, |
107 ModalDialogEvent modal_dialog_event, | 112 ModalDialogEvent modal_dialog_event, |
108 const WebPreferences& webkit_prefs, | 113 const WebPreferences& webkit_prefs, |
109 int32 view_id); | 114 int32 view_id); |
110 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); | 115 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); |
111 void OnSetCacheCapacities(size_t min_dead_capacity, | 116 void OnSetCacheCapacities(size_t min_dead_capacity, |
112 size_t max_dead_capacity, | 117 size_t max_dead_capacity, |
113 size_t capacity); | 118 size_t capacity); |
114 void OnGetCacheResourceStats(); | 119 void OnGetCacheResourceStats(); |
115 | 120 |
| 121 // Send all histograms to browser. |
| 122 void OnGetRendererHistograms(); |
| 123 |
116 // Gather usage statistics from the in-memory cache and inform our host. | 124 // Gather usage statistics from the in-memory cache and inform our host. |
117 // These functions should be call periodically so that the host can make | 125 // These functions should be call periodically so that the host can make |
118 // decisions about how to allocation resources using current information. | 126 // decisions about how to allocation resources using current information. |
119 void InformHostOfCacheStats(); | 127 void InformHostOfCacheStats(); |
120 | 128 |
121 // These objects live solely on the render thread. | 129 // These objects live solely on the render thread. |
122 VisitedLinkSlave* visited_link_slave_; | 130 VisitedLinkSlave* visited_link_slave_; |
123 UserScriptSlave* user_script_slave_; | 131 UserScriptSlave* user_script_slave_; |
124 | 132 |
125 scoped_ptr<RenderDnsMaster> render_dns_master_; | 133 scoped_ptr<RenderDnsMaster> render_dns_master_; |
126 | 134 |
| 135 scoped_ptr<RendererHistogramSnapshots> renderer_histogram_snapshots_; |
| 136 |
127 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > cache_stats_factory_; | 137 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > cache_stats_factory_; |
128 | 138 |
129 scoped_ptr<NotificationService> notification_service_; | 139 scoped_ptr<NotificationService> notification_service_; |
130 | 140 |
131 DISALLOW_COPY_AND_ASSIGN(RenderThread); | 141 DISALLOW_COPY_AND_ASSIGN(RenderThread); |
132 }; | 142 }; |
133 | 143 |
134 #endif // CHROME_RENDERER_RENDER_THREAD_H_ | 144 #endif // CHROME_RENDERER_RENDER_THREAD_H_ |
OLD | NEW |