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

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

Issue 6400007: Implement proxy for 3d-related interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: separate ParamTraits<gpu::CommandBuffer::State> into own library Created 9 years, 10 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
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/hash_tables.h"
10 #include "base/process.h" 11 #include "base/process.h"
11 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "ppapi/c/pp_rect.h"
12 #include "ppapi/c/pp_instance.h" 14 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/proxy/dispatcher.h" 15 #include "ppapi/proxy/dispatcher.h"
14 16
15 class MessageLoop; 17 class MessageLoop;
16 18
17 namespace base { 19 namespace base {
18 class WaitableEvent; 20 class WaitableEvent;
19 } 21 }
20 22
21 namespace pp { 23 namespace pp {
22 namespace proxy { 24 namespace proxy {
23 25
26 // Used to keep track of per-instance data.
27 struct InstanceData {
28 PP_Rect position;
29 };
30
24 class PluginDispatcher : public Dispatcher { 31 class PluginDispatcher : public Dispatcher {
25 public: 32 public:
26 // Constructor for the plugin side. The init and shutdown functions will be 33 // Constructor for the plugin side. The init and shutdown functions will be
27 // will be automatically called when requested by the renderer side. The 34 // will be automatically called when requested by the renderer side. The
28 // module ID will be set upon receipt of the InitializeModule message. 35 // module ID will be set upon receipt of the InitializeModule message.
29 // 36 //
30 // You must call Dispatcher::InitWithChannel after the constructor. 37 // You must call Dispatcher::InitWithChannel after the constructor.
31 PluginDispatcher(base::ProcessHandle remote_process_handle, 38 PluginDispatcher(base::ProcessHandle remote_process_handle,
32 GetInterfaceFunc get_interface, 39 GetInterfaceFunc get_interface,
33 InitModuleFunc init_module, 40 InitModuleFunc init_module,
(...skipping 17 matching lines...) Expand all
51 PluginDispatcher* dispatcher); 58 PluginDispatcher* dispatcher);
52 static void RemoveForInstance(PP_Instance instance); 59 static void RemoveForInstance(PP_Instance instance);
53 */ 60 */
54 61
55 // Dispatcher overrides. 62 // Dispatcher overrides.
56 virtual bool IsPlugin() const; 63 virtual bool IsPlugin() const;
57 64
58 // IPC::Channel::Listener implementation. 65 // IPC::Channel::Listener implementation.
59 virtual bool OnMessageReceived(const IPC::Message& msg); 66 virtual bool OnMessageReceived(const IPC::Message& msg);
60 67
68 // Keep track of all active instances to associate data with it, like the
69 // current size.
70 void DidCreateInstance(PP_Instance);
brettw 2011/01/31 18:51:29 Normally we would name the parameter here, I think
piman 2011/01/31 19:34:29 Done.
71 void DidDestroyInstance(PP_Instance);
72 InstanceData* GetInstanceData(PP_Instance);
brettw 2011/01/31 18:51:29 Can you document that this will return NULL for in
piman 2011/01/31 19:34:29 Done.
73
61 private: 74 private:
62 // IPC message handlers. 75 // IPC message handlers.
63 void OnMsgInitializeModule(PP_Module pp_module, bool* result); 76 void OnMsgInitializeModule(PP_Module pp_module, bool* result);
64 void OnMsgShutdown(); 77 void OnMsgShutdown();
65 78
66 InitModuleFunc init_module_; 79 InitModuleFunc init_module_;
67 ShutdownModuleFunc shutdown_module_; 80 ShutdownModuleFunc shutdown_module_;
68 81
82 typedef base::hash_map<PP_Instance, InstanceData> InstanceDataMap;
83 InstanceDataMap instance_map_;
84
69 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); 85 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher);
70 }; 86 };
71 87
72 } // namespace proxy 88 } // namespace proxy
73 } // namespace pp 89 } // namespace pp
74 90
75 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ 91 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698