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

Side by Side Diff: ppapi/proxy/plugin_dispatcher.h

Issue 4985001: Initial audio implementation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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 | « ppapi/proxy/interface_id.h ('k') | ppapi/proxy/plugin_dispatcher.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 PPAPI_PROXY_PLUGIN_DISPATCHER_H_ 5 #ifndef PPAPI_PROXY_PLUGIN_DISPATCHER_H_
6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_ 6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/process.h"
10 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
11 #include "ppapi/proxy/callback_tracker.h" 12 #include "ppapi/proxy/callback_tracker.h"
12 #include "ppapi/proxy/dispatcher.h" 13 #include "ppapi/proxy/dispatcher.h"
13 #include "ppapi/proxy/plugin_resource_tracker.h" 14 #include "ppapi/proxy/plugin_resource_tracker.h"
14 #include "ppapi/proxy/plugin_var_tracker.h" 15 #include "ppapi/proxy/plugin_var_tracker.h"
15 16
16 class MessageLoop; 17 class MessageLoop;
17 18
18 namespace base { 19 namespace base {
19 class WaitableEvent; 20 class WaitableEvent;
20 } 21 }
21 22
22 namespace pp { 23 namespace pp {
23 namespace proxy { 24 namespace proxy {
24 25
25 class PluginDispatcher : public Dispatcher { 26 class PluginDispatcher : public Dispatcher {
26 public: 27 public:
27 // Constructor for the plugin side. The init and shutdown functions will be 28 // Constructor for the plugin side. The init and shutdown functions will be
28 // will be automatically called when requested by the renderer side. The 29 // will be automatically called when requested by the renderer side. The
29 // module ID will be set upon receipt of the InitializeModule message. 30 // module ID will be set upon receipt of the InitializeModule message.
30 // 31 //
31 // You must call Dispatcher::InitWithChannel after the constructor. 32 // You must call Dispatcher::InitWithChannel after the constructor.
32 PluginDispatcher(GetInterfaceFunc get_interface, 33 PluginDispatcher(base::ProcessHandle remote_process_handle,
34 GetInterfaceFunc get_interface,
33 InitModuleFunc init_module, 35 InitModuleFunc init_module,
34 ShutdownModuleFunc shutdown_module); 36 ShutdownModuleFunc shutdown_module);
35 ~PluginDispatcher(); 37 ~PluginDispatcher();
36 38
37 // The plugin maintains a global Dispatcher pointer. There is only one since 39 // The plugin maintains a global Dispatcher pointer. There is only one since
38 // there is only one connection to the browser. Don't call this on the 40 // there is only one connection to the browser. Don't call this on the
39 // browser side, see GetForInstnace. 41 // browser side, see GetForInstnace.
40 static PluginDispatcher* Get(); 42 static PluginDispatcher* Get();
41 static void SetGlobal(PluginDispatcher* dispatcher); 43 static void SetGlobal(PluginDispatcher* dispatcher);
42 44
43 // Dispatcher overrides. 45 // Dispatcher overrides.
44 virtual bool IsPlugin() const { return true; } 46 virtual bool IsPlugin() const { return true; }
45 47
46 // IPC::Channel::Listener implementation. 48 // IPC::Channel::Listener implementation.
47 virtual void OnMessageReceived(const IPC::Message& msg); 49 virtual void OnMessageReceived(const IPC::Message& msg);
48 50
49 // Returns the resource tracker for the plugin. In the browser process this 51 // Returns the resource tracker for the plugin. In the browser process this
50 // will return NULL. 52 // will return NULL.
51 PluginResourceTracker* plugin_resource_tracker() { 53 PluginResourceTracker* plugin_resource_tracker() {
52 return plugin_resource_tracker_.get(); 54 return plugin_resource_tracker_.get();
53 } 55 }
54 56
55 // Returns the var tracker for the plugin. In the browser process this 57 // Returns the var tracker for the plugin. In the browser process this
56 // will return NULL. 58 // will return NULL.
57 PluginVarTracker* plugin_var_tracker() { 59 PluginVarTracker* plugin_var_tracker() {
58 return plugin_var_tracker_.get(); 60 return plugin_var_tracker_.get();
59 } 61 }
60 62
61 private: 63 private:
64 // IPC message handler.
62 void OnInitializeModule(PP_Module pp_module, bool* result); 65 void OnInitializeModule(PP_Module pp_module, bool* result);
63 66
64 InitModuleFunc init_module_; 67 InitModuleFunc init_module_;
65 ShutdownModuleFunc shutdown_module_; 68 ShutdownModuleFunc shutdown_module_;
66 69
67 scoped_ptr<PluginResourceTracker> plugin_resource_tracker_; 70 scoped_ptr<PluginResourceTracker> plugin_resource_tracker_;
68 scoped_ptr<PluginVarTracker> plugin_var_tracker_; 71 scoped_ptr<PluginVarTracker> plugin_var_tracker_;
69 72
70 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); 73 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher);
71 }; 74 };
72 75
73 } // namespace proxy 76 } // namespace proxy
74 } // namespace pp 77 } // namespace pp
75 78
76 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ 79 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/interface_id.h ('k') | ppapi/proxy/plugin_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698