| 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/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
| 11 #include "base/task.h" | 11 #include "base/task.h" |
| 12 #include "base/thread.h" | 12 #include "base/thread.h" |
| 13 #include "chrome/common/ipc_sync_channel.h" | 13 #include "chrome/common/ipc_sync_channel.h" |
| 14 #include "chrome/common/message_router.h" | 14 #include "chrome/common/message_router.h" |
| 15 | 15 |
| 16 class SkBitmap; | 16 class SkBitmap; |
| 17 class Task; | 17 class Task; |
| 18 class VisitedLinkSlave; | 18 class VisitedLinkSlave; |
| 19 struct WebPreferences; | 19 struct WebPreferences; |
| 20 class RenderDnsMaster; | 20 class RenderDnsMaster; |
| 21 class NotificationService; | 21 class NotificationService; |
| 22 class GreasemonkeySlave; | 22 class UserScriptSlave; |
| 23 | 23 |
| 24 // The RenderThreadBase is the minimal interface that a RenderView/Widget | 24 // The RenderThreadBase is the minimal interface that a RenderView/Widget |
| 25 // expects from a render thread. The interface basically abstracts a way to send | 25 // expects from a render thread. The interface basically abstracts a way to send |
| 26 // and receive messages. | 26 // and receive messages. |
| 27 class RenderThreadBase : public IPC::Message::Sender { | 27 class RenderThreadBase : public IPC::Message::Sender { |
| 28 public: | 28 public: |
| 29 virtual ~RenderThreadBase() {} | 29 virtual ~RenderThreadBase() {} |
| 30 | 30 |
| 31 // True if currently sending a message. | 31 // True if currently sending a message. |
| 32 virtual bool InSend() const = 0; | 32 virtual bool InSend() const = 0; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 63 // IPC::Message::Sender implementation: | 63 // IPC::Message::Sender implementation: |
| 64 virtual bool Send(IPC::Message* msg); | 64 virtual bool Send(IPC::Message* msg); |
| 65 | 65 |
| 66 // Overridded from RenderThreadBase. | 66 // Overridded from RenderThreadBase. |
| 67 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter); | 67 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter); |
| 68 virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter); | 68 virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter); |
| 69 | 69 |
| 70 // Gets the VisitedLinkSlave instance for this thread | 70 // Gets the VisitedLinkSlave instance for this thread |
| 71 VisitedLinkSlave* visited_link_slave() const { return visited_link_slave_; } | 71 VisitedLinkSlave* visited_link_slave() const { return visited_link_slave_; } |
| 72 | 72 |
| 73 // Gets the GreasemonkeySlave instance for this thread | 73 // Gets the UserScriptSlave instance for this thread |
| 74 GreasemonkeySlave* greasemonkey_slave() const { return greasemonkey_slave_; } | 74 UserScriptSlave* user_script_slave() const { return user_script_slave_; } |
| 75 | 75 |
| 76 // Do DNS prefetch resolution of a hostname. | 76 // Do DNS prefetch resolution of a hostname. |
| 77 void Resolve(const char* name, size_t length); | 77 void Resolve(const char* name, size_t length); |
| 78 | 78 |
| 79 // See documentation on MessageRouter for AddRoute and RemoveRoute | 79 // See documentation on MessageRouter for AddRoute and RemoveRoute |
| 80 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); | 80 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); |
| 81 virtual void RemoveRoute(int32 routing_id); | 81 virtual void RemoveRoute(int32 routing_id); |
| 82 | 82 |
| 83 // Invokes InformHostOfCacheStats after a short delay. Used to move this | 83 // Invokes InformHostOfCacheStats after a short delay. Used to move this |
| 84 // bookkeeping operation off the critical latency path. | 84 // bookkeeping operation off the critical latency path. |
| 85 void InformHostOfCacheStatsLater(); | 85 void InformHostOfCacheStatsLater(); |
| 86 | 86 |
| 87 MessageLoop* owner_loop() { return owner_loop_; } | 87 MessageLoop* owner_loop() { return owner_loop_; } |
| 88 | 88 |
| 89 // Indicates if RenderThread::Send() is on the call stack. | 89 // Indicates if RenderThread::Send() is on the call stack. |
| 90 virtual bool InSend() const { return in_send_ != 0; } | 90 virtual bool InSend() const { return in_send_ != 0; } |
| 91 | 91 |
| 92 protected: | 92 protected: |
| 93 // Called by the thread base class | 93 // Called by the thread base class |
| 94 virtual void Init(); | 94 virtual void Init(); |
| 95 virtual void CleanUp(); | 95 virtual void CleanUp(); |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 void OnUpdateVisitedLinks(base::SharedMemoryHandle table); | 98 void OnUpdateVisitedLinks(base::SharedMemoryHandle table); |
| 99 void OnUpdateGreasemonkeyScripts(base::SharedMemoryHandle table); | 99 void OnUpdateUserScripts(base::SharedMemoryHandle table); |
| 100 | 100 |
| 101 void OnPluginMessage(const FilePath& plugin_path, | 101 void OnPluginMessage(const FilePath& plugin_path, |
| 102 const std::vector<uint8>& data); | 102 const std::vector<uint8>& data); |
| 103 void OnSetNextPageID(int32 next_page_id); | 103 void OnSetNextPageID(int32 next_page_id); |
| 104 void OnCreateNewView(HWND parent_hwnd, | 104 void OnCreateNewView(HWND parent_hwnd, |
| 105 HANDLE modal_dialog_event, | 105 HANDLE modal_dialog_event, |
| 106 const WebPreferences& webkit_prefs, | 106 const WebPreferences& webkit_prefs, |
| 107 int32 view_id); | 107 int32 view_id); |
| 108 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); | 108 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); |
| 109 void OnSetCacheCapacities(size_t min_dead_capacity, | 109 void OnSetCacheCapacities(size_t min_dead_capacity, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 121 | 121 |
| 122 // Used only on the background render thread to implement message routing | 122 // Used only on the background render thread to implement message routing |
| 123 // functionality to the consumers of the RenderThread. | 123 // functionality to the consumers of the RenderThread. |
| 124 MessageRouter router_; | 124 MessageRouter router_; |
| 125 | 125 |
| 126 std::wstring channel_name_; | 126 std::wstring channel_name_; |
| 127 scoped_ptr<IPC::SyncChannel> channel_; | 127 scoped_ptr<IPC::SyncChannel> channel_; |
| 128 | 128 |
| 129 // These objects live solely on the render thread. | 129 // These objects live solely on the render thread. |
| 130 VisitedLinkSlave* visited_link_slave_; | 130 VisitedLinkSlave* visited_link_slave_; |
| 131 GreasemonkeySlave* greasemonkey_slave_; | 131 UserScriptSlave* user_script_slave_; |
| 132 | 132 |
| 133 scoped_ptr<RenderDnsMaster> render_dns_master_; | 133 scoped_ptr<RenderDnsMaster> render_dns_master_; |
| 134 | 134 |
| 135 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > cache_stats_factory_; | 135 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > cache_stats_factory_; |
| 136 | 136 |
| 137 scoped_ptr<NotificationService> notification_service_; | 137 scoped_ptr<NotificationService> notification_service_; |
| 138 | 138 |
| 139 int in_send_; | 139 int in_send_; |
| 140 | 140 |
| 141 DISALLOW_EVIL_CONSTRUCTORS(RenderThread); | 141 DISALLOW_EVIL_CONSTRUCTORS(RenderThread); |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 // The global RenderThread object for this process. Note that this should only | 144 // The global RenderThread object for this process. Note that this should only |
| 145 // be accessed when running on the render thread itself. | 145 // be accessed when running on the render thread itself. |
| 146 extern RenderThread* g_render_thread; | 146 extern RenderThread* g_render_thread; |
| 147 | 147 |
| 148 #endif // CHROME_RENDERER_RENDER_THREAD_H_ | 148 #endif // CHROME_RENDERER_RENDER_THREAD_H_ |
| OLD | NEW |