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

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

Issue 7844018: Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | « ppapi/proxy/interface_list.cc ('k') | ppapi/proxy/interface_proxy.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) 2011 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_INTERFACE_PROXY_H_ 5 #ifndef PPAPI_PROXY_INTERFACE_PROXY_H_
6 #define PPAPI_PROXY_INTERFACE_PROXY_H_ 6 #define PPAPI_PROXY_INTERFACE_PROXY_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "ipc/ipc_channel.h" 9 #include "ipc/ipc_channel.h"
10 #include "ipc/ipc_message.h" 10 #include "ipc/ipc_message.h"
11 #include "ppapi/c/pp_completion_callback.h" 11 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_resource.h" 12 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/pp_var.h" 13 #include "ppapi/c/pp_var.h"
14 #include "ppapi/proxy/interface_id.h" 14 #include "ppapi/proxy/interface_id.h"
15 #include "ppapi/shared_impl/function_group_base.h"
16 15
17 namespace ppapi { 16 namespace ppapi {
18 namespace proxy { 17 namespace proxy {
19 18
20 class Dispatcher; 19 class Dispatcher;
21 20
22 class InterfaceProxy : public IPC::Channel::Listener, 21 class InterfaceProxy : public IPC::Channel::Listener,
23 public IPC::Message::Sender, 22 public IPC::Message::Sender {
24 public FunctionGroupBase {
25 public: 23 public:
26 // Factory function type for interfaces. Ownership of the returned pointer 24 // Factory function type for interfaces. Ownership of the returned pointer
27 // is transferred to the caller. 25 // is transferred to the caller.
28 typedef InterfaceProxy* (*Factory)(Dispatcher* dispatcher); 26 typedef InterfaceProxy* (*Factory)(Dispatcher* dispatcher,
27 const void* target_interface);
29 28
30 // DEPRECATED: New classes should be registered directly in the interface
31 // list. This is kept around until we convert all the existing code.
32 //
33 // Information about the interface. Each interface has a static function to 29 // Information about the interface. Each interface has a static function to
34 // return its info, which allows either construction on the target side, and 30 // return its info, which allows either construction on the target side, and
35 // getting the proxied interface on the source side (see dispatcher.h for 31 // getting the proxied interface on the source side (see dispatcher.h for
36 // terminology). 32 // terminology).
37 struct Info { 33 struct Info {
38 const void* interface_ptr; 34 const void* interface_ptr;
39 35
40 const char* name; 36 const char* name;
41 InterfaceID id; 37 InterfaceID id;
42 38
43 bool is_trusted; 39 bool is_trusted;
44 40
45 InterfaceProxy::Factory create_proxy; 41 InterfaceProxy::Factory create_proxy;
46 }; 42 };
47 43
48 virtual ~InterfaceProxy(); 44 virtual ~InterfaceProxy();
49 45
46 // The actual implementation of the given interface in the current process.
47 const void* target_interface() const { return target_interface_; }
48
50 Dispatcher* dispatcher() const { return dispatcher_; } 49 Dispatcher* dispatcher() const { return dispatcher_; }
51 50
52 // IPC::Message::Sender implementation. 51 // IPC::Message::Sender implementation.
53 virtual bool Send(IPC::Message* msg); 52 virtual bool Send(IPC::Message* msg);
54 53
55 // Sub-classes must implement IPC::Channel::Listener which contains this: 54 // Sub-classes must implement IPC::Channel::Listener which contains this:
56 //virtual bool OnMessageReceived(const IPC::Message& msg); 55 //virtual bool OnMessageReceived(const IPC::Message& msg);
57 56
58 protected: 57 protected:
59 // Creates the given interface associated with the given dispatcher. The 58 // Creates the given interface associated with the given dispatcher. The
60 // dispatcher manages our lifetime. 59 // dispatcher manages our lifetime.
61 InterfaceProxy(Dispatcher* dispatcher); 60 //
61 // The target interface pointer, when non-NULL, indicates that this is a
62 // target proxy (see dispatcher.h for a definition). In this case, the proxy
63 // will interpret this pointer to the actual implementation of the interface
64 // in the local process.
65 InterfaceProxy(Dispatcher* dispatcher, const void* target_interface);
62 66
63 uint32 SendCallback(PP_CompletionCallback callback); 67 uint32 SendCallback(PP_CompletionCallback callback);
64 PP_CompletionCallback ReceiveCallback(uint32 serialized_callback); 68 PP_CompletionCallback ReceiveCallback(uint32 serialized_callback);
65 69
66 private: 70 private:
67 Dispatcher* dispatcher_; 71 Dispatcher* dispatcher_;
72 const void* target_interface_;
68 }; 73 };
69 74
70 } // namespace proxy 75 } // namespace proxy
71 } // namespace ppapi 76 } // namespace ppapi
72 77
73 #endif // PPAPI_PROXY_INTERFACE_PROXY_H_ 78 #endif // PPAPI_PROXY_INTERFACE_PROXY_H_
74 79
OLDNEW
« no previous file with comments | « ppapi/proxy/interface_list.cc ('k') | ppapi/proxy/interface_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698