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_PLUGIN_PLUGIN_THREAD_H_ | 5 #ifndef CHROME_PLUGIN_PLUGIN_THREAD_H_ |
6 #define CHROME_PLUGIN_PLUGIN_THREAD_H_ | 6 #define CHROME_PLUGIN_PLUGIN_THREAD_H_ |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "chrome/common/child_thread.h" | 9 #include "chrome/common/child_thread.h" |
10 #include "chrome/common/resource_dispatcher.h" | 10 #include "chrome/common/resource_dispatcher.h" |
11 #include "chrome/plugin/plugin_channel.h" | 11 #include "chrome/plugin/plugin_channel.h" |
12 | 12 |
13 class NotificationService; | 13 class NotificationService; |
14 | 14 |
15 // The PluginThread class represents a background thread where plugin instances | 15 // The PluginThread class represents a background thread where plugin instances |
16 // live. Communication occurs between WebPluginDelegateProxy in the renderer | 16 // live. Communication occurs between WebPluginDelegateProxy in the renderer |
17 // process and WebPluginDelegateStub in this thread through IPC messages. | 17 // process and WebPluginDelegateStub in this thread through IPC messages. |
18 class PluginThread : public ChildThread { | 18 class PluginThread : public ChildThread { |
19 public: | 19 public: |
20 PluginThread(); | 20 PluginThread(); |
21 ~PluginThread(); | 21 ~PluginThread(); |
22 | 22 |
23 // Returns the one plugin thread. | 23 // Returns the one plugin thread. |
24 static PluginThread* current(); | 24 static PluginThread* current(); |
25 | 25 |
26 // Returns the one true dispatcher. | 26 // Returns the one true dispatcher. |
27 ResourceDispatcher* resource_dispatcher() { return resource_dispatcher_.get();
} | 27 ResourceDispatcher* resource_dispatcher() { |
| 28 return resource_dispatcher_.get(); |
| 29 } |
28 | 30 |
29 private: | 31 private: |
30 virtual void OnControlMessageReceived(const IPC::Message& msg); | 32 virtual void OnControlMessageReceived(const IPC::Message& msg); |
31 | 33 |
32 // Thread implementation: | 34 // Thread implementation: |
33 virtual void Init(); | 35 virtual void Init(); |
34 virtual void CleanUp(); | 36 virtual void CleanUp(); |
35 | 37 |
36 void OnCreateChannel(int process_id, HANDLE renderer); | 38 void OnCreateChannel(int process_id, HANDLE renderer); |
37 void OnShutdownResponse(bool ok_to_shutdown); | 39 void OnShutdownResponse(bool ok_to_shutdown); |
38 void OnPluginMessage(const std::vector<uint8> &data); | 40 void OnPluginMessage(const std::vector<uint8> &data); |
39 void OnBrowserShutdown(); | 41 void OnBrowserShutdown(); |
40 | 42 |
41 scoped_ptr<NotificationService> notification_service_; | 43 scoped_ptr<NotificationService> notification_service_; |
42 | 44 |
43 // Handles resource loads for this view. | 45 // Handles resource loads for this view. |
44 // NOTE: this object lives on the owner thread. | 46 // NOTE: this object lives on the owner thread. |
45 scoped_refptr<ResourceDispatcher> resource_dispatcher_; | 47 scoped_refptr<ResourceDispatcher> resource_dispatcher_; |
46 | 48 |
47 // The plugin module which is preloaded in Init | 49 // The plugin module which is preloaded in Init |
48 HMODULE preloaded_plugin_module_; | 50 HMODULE preloaded_plugin_module_; |
49 | 51 |
50 // Points to the plugin file that this process hosts. | 52 // Points to the plugin file that this process hosts. |
51 FilePath plugin_path_; | 53 FilePath plugin_path_; |
52 | 54 |
53 DISALLOW_EVIL_CONSTRUCTORS(PluginThread); | 55 DISALLOW_EVIL_CONSTRUCTORS(PluginThread); |
54 }; | 56 }; |
55 | 57 |
56 #endif // CHROME_PLUGIN_PLUGIN_THREAD_H_ | 58 #endif // CHROME_PLUGIN_PLUGIN_THREAD_H_ |
OLD | NEW |