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 #include "chrome/renderer/renderer_histogram_snapshots.h" |
16 | 16 |
17 class FilePath; | 17 class FilePath; |
18 class NotificationService; | 18 class NotificationService; |
19 class RenderDnsMaster; | 19 class RenderDnsMaster; |
20 class RendererHistogram; | 20 class RendererHistogram; |
| 21 class RendererWebKitClientImpl; |
21 class SkBitmap; | 22 class SkBitmap; |
22 class UserScriptSlave; | 23 class UserScriptSlave; |
23 class VisitedLinkSlave; | 24 class VisitedLinkSlave; |
24 struct ModalDialogEvent; | 25 struct ModalDialogEvent; |
25 struct WebPreferences; | 26 struct WebPreferences; |
26 | 27 |
27 namespace webkit_glue { | |
28 class WebKitClientImpl; | |
29 } | |
30 | |
31 // The RenderThreadBase is the minimal interface that a RenderView/Widget | 28 // The RenderThreadBase is the minimal interface that a RenderView/Widget |
32 // expects from a render thread. The interface basically abstracts a way to send | 29 // expects from a render thread. The interface basically abstracts a way to send |
33 // and receive messages. | 30 // and receive messages. |
34 class RenderThreadBase { | 31 class RenderThreadBase { |
35 public: | 32 public: |
36 virtual ~RenderThreadBase() {} | 33 virtual ~RenderThreadBase() {} |
37 | 34 |
38 virtual bool Send(IPC::Message* msg) = 0; | 35 virtual bool Send(IPC::Message* msg) = 0; |
39 | 36 |
40 // Called to add or remove a listener for a particular message routing ID. | 37 // Called to add or remove a listener for a particular message routing ID. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener) { | 73 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener) { |
77 return ChildThread::AddRoute(routing_id, listener); | 74 return ChildThread::AddRoute(routing_id, listener); |
78 } | 75 } |
79 virtual void RemoveRoute(int32 routing_id) { | 76 virtual void RemoveRoute(int32 routing_id) { |
80 return ChildThread::RemoveRoute(routing_id); | 77 return ChildThread::RemoveRoute(routing_id); |
81 } | 78 } |
82 | 79 |
83 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter); | 80 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter); |
84 virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter); | 81 virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter); |
85 | 82 |
86 // Gets the VisitedLinkSlave instance for this thread | 83 VisitedLinkSlave* visited_link_slave() const { |
87 VisitedLinkSlave* visited_link_slave() const { return visited_link_slave_; } | 84 return visited_link_slave_.get(); |
| 85 } |
88 | 86 |
89 // Gets the UserScriptSlave instance for this thread | 87 UserScriptSlave* user_script_slave() const { |
90 UserScriptSlave* user_script_slave() const { return user_script_slave_; } | 88 return user_script_slave_.get(); |
| 89 } |
91 | 90 |
92 // Do DNS prefetch resolution of a hostname. | 91 // Do DNS prefetch resolution of a hostname. |
93 void Resolve(const char* name, size_t length); | 92 void Resolve(const char* name, size_t length); |
94 | 93 |
95 // Send all the Histogram data to browser. | 94 // Send all the Histogram data to browser. |
96 void SendHistograms(); | 95 void SendHistograms(); |
97 | 96 |
98 // Invokes InformHostOfCacheStats after a short delay. Used to move this | 97 // Invokes InformHostOfCacheStats after a short delay. Used to move this |
99 // bookkeeping operation off the critical latency path. | 98 // bookkeeping operation off the critical latency path. |
100 void InformHostOfCacheStatsLater(); | 99 void InformHostOfCacheStatsLater(); |
(...skipping 23 matching lines...) Expand all Loading... |
124 | 123 |
125 // Send all histograms to browser. | 124 // Send all histograms to browser. |
126 void OnGetRendererHistograms(); | 125 void OnGetRendererHistograms(); |
127 | 126 |
128 // Gather usage statistics from the in-memory cache and inform our host. | 127 // Gather usage statistics from the in-memory cache and inform our host. |
129 // These functions should be call periodically so that the host can make | 128 // These functions should be call periodically so that the host can make |
130 // decisions about how to allocation resources using current information. | 129 // decisions about how to allocation resources using current information. |
131 void InformHostOfCacheStats(); | 130 void InformHostOfCacheStats(); |
132 | 131 |
133 // These objects live solely on the render thread. | 132 // These objects live solely on the render thread. |
134 VisitedLinkSlave* visited_link_slave_; | 133 scoped_ptr<VisitedLinkSlave> visited_link_slave_; |
135 UserScriptSlave* user_script_slave_; | |
136 | 134 |
137 scoped_ptr<RenderDnsMaster> render_dns_master_; | 135 scoped_ptr<UserScriptSlave> user_script_slave_; |
138 | 136 |
139 scoped_ptr<RendererHistogramSnapshots> renderer_histogram_snapshots_; | 137 scoped_ptr<RenderDnsMaster> dns_master_; |
| 138 |
| 139 scoped_ptr<RendererHistogramSnapshots> histogram_snapshots_; |
140 | 140 |
141 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > cache_stats_factory_; | 141 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > cache_stats_factory_; |
142 | 142 |
143 scoped_ptr<NotificationService> notification_service_; | 143 scoped_ptr<NotificationService> notification_service_; |
144 | 144 |
145 scoped_ptr<webkit_glue::WebKitClientImpl> webkit_client_impl_; | 145 scoped_ptr<RendererWebKitClientImpl> webkit_client_impl_; |
146 | 146 |
147 DISALLOW_COPY_AND_ASSIGN(RenderThread); | 147 DISALLOW_COPY_AND_ASSIGN(RenderThread); |
148 }; | 148 }; |
149 | 149 |
150 #endif // CHROME_RENDERER_RENDER_THREAD_H_ | 150 #endif // CHROME_RENDERER_RENDER_THREAD_H_ |
OLD | NEW |