Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: content/ppapi_plugin/ppapi_thread.h

Issue 10378057: Broker out PPAPI handle duplication (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/ppapi_plugin/plugin_process_dispatcher.cc ('k') | content/ppapi_plugin/ppapi_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ 5 #ifndef CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_
6 #define CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ 6 #define CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/process.h" 15 #include "base/process.h"
16 #include "base/scoped_native_library.h" 16 #include "base/scoped_native_library.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "content/common/child_thread.h" 18 #include "content/common/child_thread.h"
19 #include "ppapi/c/pp_module.h" 19 #include "ppapi/c/pp_module.h"
20 #include "ppapi/c/trusted/ppp_broker.h" 20 #include "ppapi/c/trusted/ppp_broker.h"
21 #include "ppapi/proxy/plugin_dispatcher.h" 21 #include "ppapi/proxy/plugin_dispatcher.h"
22 #include "ppapi/proxy/plugin_globals.h" 22 #include "ppapi/proxy/plugin_globals.h"
23 #include "ppapi/proxy/plugin_proxy_delegate.h" 23 #include "ppapi/proxy/plugin_proxy_delegate.h"
24 24
25 #if defined(OS_WIN)
26 #include "base/win/scoped_handle.h"
27 #endif
28
25 class CommandLine; 29 class CommandLine;
26 class FilePath; 30 class FilePath;
27 class PpapiWebKitPlatformSupportImpl; 31 class PpapiWebKitPlatformSupportImpl;
28 32
29 namespace IPC { 33 namespace IPC {
30 struct ChannelHandle; 34 struct ChannelHandle;
31 } 35 }
32 36
33 class PpapiThread : public ChildThread, 37 class PpapiThread : public ChildThread,
34 public ppapi::proxy::PluginDispatcher::PluginDelegate, 38 public ppapi::proxy::PluginDispatcher::PluginDelegate,
35 public ppapi::proxy::PluginProxyDelegate { 39 public ppapi::proxy::PluginProxyDelegate {
36 public: 40 public:
37 PpapiThread(const CommandLine& command_line, bool is_broker); 41 PpapiThread(const CommandLine& command_line, bool is_broker);
38 virtual ~PpapiThread(); 42 virtual ~PpapiThread();
39 43
40 private: 44 private:
41 // ChildThread overrides. 45 // ChildThread overrides.
42 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 46 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
47 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
43 48
44 // PluginDispatcher::PluginDelegate implementation. 49 // PluginDispatcher::PluginDelegate implementation.
45 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet() OVERRIDE; 50 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet() OVERRIDE;
46 virtual base::MessageLoopProxy* GetIPCMessageLoop() OVERRIDE; 51 virtual base::MessageLoopProxy* GetIPCMessageLoop() OVERRIDE;
47 virtual base::WaitableEvent* GetShutdownEvent() OVERRIDE; 52 virtual base::WaitableEvent* GetShutdownEvent() OVERRIDE;
53 virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
54 base::PlatformFile handle,
55 const IPC::SyncChannel& channel,
56 bool should_close_source) OVERRIDE;
48 virtual uint32 Register( 57 virtual uint32 Register(
49 ppapi::proxy::PluginDispatcher* plugin_dispatcher) OVERRIDE; 58 ppapi::proxy::PluginDispatcher* plugin_dispatcher) OVERRIDE;
50 virtual void Unregister(uint32 plugin_dispatcher_id) OVERRIDE; 59 virtual void Unregister(uint32 plugin_dispatcher_id) OVERRIDE;
51 60
52 // PluginProxyDelegate. 61 // PluginProxyDelegate.
53 virtual bool SendToBrowser(IPC::Message* msg) OVERRIDE; 62 virtual bool SendToBrowser(IPC::Message* msg) OVERRIDE;
54 virtual void PreCacheFont(const void* logfontw) OVERRIDE; 63 virtual void PreCacheFont(const void* logfontw) OVERRIDE;
55 64
56 // Message handlers. 65 // Message handlers.
57 void OnMsgLoadPlugin(const FilePath& path); 66 void OnMsgLoadPlugin(const FilePath& path);
58 void OnMsgCreateChannel(base::ProcessHandle host_process_handle, 67 void OnMsgCreateChannel(int renderer_id,
59 int renderer_id,
60 bool incognito); 68 bool incognito);
61 void OnMsgSetNetworkState(bool online); 69 void OnMsgSetNetworkState(bool online);
62 void OnPluginDispatcherMessageReceived(const IPC::Message& msg); 70 void OnPluginDispatcherMessageReceived(const IPC::Message& msg);
63 71
64 // Sets up the channel to the given renderer. On success, returns true and 72 // Sets up the channel to the given renderer. On success, returns true and
65 // fills the given ChannelHandle with the information from the new channel. 73 // fills the given ChannelHandle with the information from the new channel.
66 bool SetupRendererChannel(base::ProcessHandle host_process_handle, 74 bool SetupRendererChannel(int renderer_id,
67 int renderer_id,
68 bool incognito, 75 bool incognito,
69 IPC::ChannelHandle* handle); 76 IPC::ChannelHandle* handle);
70 77
71 // Sets up the name of the plugin for logging using the given path. 78 // Sets up the name of the plugin for logging using the given path.
72 void SavePluginName(const FilePath& path); 79 void SavePluginName(const FilePath& path);
73 80
74 // True if running in a broker process rather than a normal plugin process. 81 // True if running in a broker process rather than a normal plugin process.
75 bool is_broker_; 82 bool is_broker_;
76 83
77 base::ScopedNativeLibrary library_; 84 base::ScopedNativeLibrary library_;
(...skipping 18 matching lines...) Expand all
96 // See Dispatcher::Delegate::GetGloballySeenInstanceIDSet. 103 // See Dispatcher::Delegate::GetGloballySeenInstanceIDSet.
97 std::set<PP_Instance> globally_seen_instance_ids_; 104 std::set<PP_Instance> globally_seen_instance_ids_;
98 105
99 // The PluginDispatcher instances contained in the map are not owned by it. 106 // The PluginDispatcher instances contained in the map are not owned by it.
100 std::map<uint32, ppapi::proxy::PluginDispatcher*> plugin_dispatchers_; 107 std::map<uint32, ppapi::proxy::PluginDispatcher*> plugin_dispatchers_;
101 uint32 next_plugin_dispatcher_id_; 108 uint32 next_plugin_dispatcher_id_;
102 109
103 // The WebKitPlatformSupport implementation. 110 // The WebKitPlatformSupport implementation.
104 scoped_ptr<PpapiWebKitPlatformSupportImpl> webkit_platform_support_; 111 scoped_ptr<PpapiWebKitPlatformSupportImpl> webkit_platform_support_;
105 112
113 #if defined(OS_WIN)
114 // Caches the handle to the peer process if this is a broker.
115 base::win::ScopedHandle peer_handle_;
116 #endif
117
106 DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread); 118 DISALLOW_IMPLICIT_CONSTRUCTORS(PpapiThread);
107 }; 119 };
108 120
109 #endif // CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_ 121 #endif // CONTENT_PPAPI_PLUGIN_PPAPI_THREAD_H_
OLDNEW
« no previous file with comments | « content/ppapi_plugin/plugin_process_dispatcher.cc ('k') | content/ppapi_plugin/ppapi_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698