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 "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
11 #include "base/thread.h" | 11 #include "base/thread.h" |
12 #include "base/thread_local_storage.h" | |
13 #include "chrome/common/ipc_sync_channel.h" | 12 #include "chrome/common/ipc_sync_channel.h" |
14 #include "chrome/common/message_router.h" | 13 #include "chrome/common/message_router.h" |
15 | 14 |
16 class SkBitmap; | 15 class SkBitmap; |
17 class Task; | 16 class Task; |
18 class VisitedLinkSlave; | 17 class VisitedLinkSlave; |
19 struct WebPreferences; | 18 struct WebPreferences; |
20 class RenderDnsMaster; | 19 class RenderDnsMaster; |
21 class NotificationService; | 20 class NotificationService; |
22 | 21 |
(...skipping 18 matching lines...) Expand all Loading... |
41 virtual void OnMessageReceived(const IPC::Message& msg); | 40 virtual void OnMessageReceived(const IPC::Message& msg); |
42 virtual void OnChannelError(); | 41 virtual void OnChannelError(); |
43 | 42 |
44 // IPC::Message::Sender implementation: | 43 // IPC::Message::Sender implementation: |
45 virtual bool Send(IPC::Message* msg); | 44 virtual bool Send(IPC::Message* msg); |
46 | 45 |
47 void AddFilter(IPC::ChannelProxy::MessageFilter* filter); | 46 void AddFilter(IPC::ChannelProxy::MessageFilter* filter); |
48 void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter); | 47 void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter); |
49 | 48 |
50 // The RenderThread instance for the current thread. | 49 // The RenderThread instance for the current thread. |
51 static RenderThread* current() { | 50 static RenderThread* current(); |
52 return static_cast<RenderThread*>(tls_index_.Get()); | |
53 } | |
54 | 51 |
55 VisitedLinkSlave* visited_link_slave() const { return visited_link_slave_; } | 52 VisitedLinkSlave* visited_link_slave() const { return visited_link_slave_; } |
56 | 53 |
57 // Do DNS prefetch resolution of a hostname. | 54 // Do DNS prefetch resolution of a hostname. |
58 void Resolve(const char* name, size_t length); | 55 void Resolve(const char* name, size_t length); |
59 | 56 |
60 // See documentation on MessageRouter for AddRoute and RemoveRoute | 57 // See documentation on MessageRouter for AddRoute and RemoveRoute |
61 void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); | 58 void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); |
62 void RemoveRoute(int32 routing_id); | 59 void RemoveRoute(int32 routing_id); |
63 | 60 |
(...skipping 23 matching lines...) Expand all Loading... |
87 void OnSetCacheCapacities(size_t min_dead_capacity, | 84 void OnSetCacheCapacities(size_t min_dead_capacity, |
88 size_t max_dead_capacity, | 85 size_t max_dead_capacity, |
89 size_t capacity); | 86 size_t capacity); |
90 void OnGetCacheResourceStats(); | 87 void OnGetCacheResourceStats(); |
91 | 88 |
92 // Gather usage statistics from the in-memory cache and inform our host. | 89 // Gather usage statistics from the in-memory cache and inform our host. |
93 // These functions should be call periodically so that the host can make | 90 // These functions should be call periodically so that the host can make |
94 // decisions about how to allocation resources using current information. | 91 // decisions about how to allocation resources using current information. |
95 void InformHostOfCacheStats(); | 92 void InformHostOfCacheStats(); |
96 | 93 |
97 static TLSSlot tls_index_; | |
98 | |
99 // The message loop used to run tasks on the thread that started this thread. | 94 // The message loop used to run tasks on the thread that started this thread. |
100 MessageLoop* owner_loop_; | 95 MessageLoop* owner_loop_; |
101 | 96 |
102 // Used only on the background render thread to implement message routing | 97 // Used only on the background render thread to implement message routing |
103 // functionality to the consumers of the RenderThread. | 98 // functionality to the consumers of the RenderThread. |
104 MessageRouter router_; | 99 MessageRouter router_; |
105 | 100 |
106 std::wstring channel_name_; | 101 std::wstring channel_name_; |
107 scoped_ptr<IPC::SyncChannel> channel_; | 102 scoped_ptr<IPC::SyncChannel> channel_; |
108 | 103 |
109 // These objects live solely on the render thread. | 104 // These objects live solely on the render thread. |
110 VisitedLinkSlave* visited_link_slave_; | 105 VisitedLinkSlave* visited_link_slave_; |
111 | 106 |
112 scoped_ptr<RenderDnsMaster> render_dns_master_; | 107 scoped_ptr<RenderDnsMaster> render_dns_master_; |
113 | 108 |
114 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > cache_stats_factory_; | 109 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > cache_stats_factory_; |
115 | 110 |
116 scoped_ptr<NotificationService> notification_service_; | 111 scoped_ptr<NotificationService> notification_service_; |
117 | 112 |
118 int in_send_; | 113 int in_send_; |
119 | 114 |
120 DISALLOW_EVIL_CONSTRUCTORS(RenderThread); | 115 DISALLOW_EVIL_CONSTRUCTORS(RenderThread); |
121 }; | 116 }; |
122 | 117 |
123 #endif // CHROME_RENDERER_RENDER_THREAD_H__ | 118 #endif // CHROME_RENDERER_RENDER_THREAD_H__ |
124 | 119 |
OLD | NEW |