OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_PLUGIN_PLUGIN_THREAD_H_ | |
6 #define CONTENT_PLUGIN_PLUGIN_THREAD_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "base/files/file_path.h" | |
11 #include "base/macros.h" | |
12 #include "base/native_library.h" | |
13 #include "build/build_config.h" | |
14 #include "content/child/child_thread_impl.h" | |
15 #include "content/child/npapi/plugin_lib.h" | |
16 #include "content/plugin/plugin_channel.h" | |
17 | |
18 #if defined(OS_POSIX) | |
19 #include "base/file_descriptor_posix.h" | |
20 #endif | |
21 | |
22 namespace content { | |
23 class BlinkPlatformImpl; | |
24 | |
25 // The PluginThread class represents a background thread where plugin instances | |
26 // live. Communication occurs between WebPluginDelegateProxy in the renderer | |
27 // process and WebPluginDelegateStub in this thread through IPC messages. | |
28 class PluginThread : public ChildThreadImpl { | |
29 public: | |
30 PluginThread(); | |
31 ~PluginThread() override; | |
32 void Shutdown() override; | |
33 | |
34 // Returns the one plugin thread. | |
35 static PluginThread* current(); | |
36 | |
37 // Tells the plugin thread to terminate the process forcefully instead of | |
38 // exiting cleanly. | |
39 void SetForcefullyTerminatePluginProcess(); | |
40 | |
41 private: | |
42 bool OnControlMessageReceived(const IPC::Message& msg) override; | |
43 | |
44 // Callback for when a channel has been created. | |
45 void OnCreateChannel(int renderer_id, bool incognito); | |
46 void OnPluginMessage(const std::vector<uint8_t>& data); | |
47 void OnNotifyRenderersOfPendingShutdown(); | |
48 #if defined(OS_MACOSX) | |
49 void OnAppActivated(); | |
50 void OnPluginFocusNotify(uint32_t instance_id); | |
51 #endif | |
52 | |
53 // The plugin module which is preloaded in Init | |
54 base::NativeLibrary preloaded_plugin_module_; | |
55 | |
56 bool forcefully_terminate_plugin_process_; | |
57 | |
58 scoped_ptr<BlinkPlatformImpl> blink_platform_impl_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(PluginThread); | |
61 }; | |
62 | |
63 } // namespace content | |
64 | |
65 #endif // CONTENT_PLUGIN_PLUGIN_THREAD_H_ | |
OLD | NEW |