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

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.h

Issue 7740013: Cloning a bunch of stuff from the native_client repository at r6528 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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
(Empty)
1 // Copyright (c) 2011 The Native Client 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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_H_
6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_H_
7
8 #include <stdarg.h>
9
10 #include "native_client/src/include/nacl_macros.h"
11 #include "native_client/src/include/portability.h"
12 #include "native_client/src/shared/srpc/nacl_srpc.h"
13 #include "native_client/src/shared/platform/nacl_check.h"
14 #include "native_client/src/shared/platform/nacl_threads.h"
15 #include "native_client/src/trusted/desc/nacl_desc_invalid.h"
16 #include "ppapi/c/pp_instance.h"
17 #include "ppapi/c/ppp.h"
18 #include "ppapi/c/ppp_instance.h"
19 #include "ppapi/c/ppp_messaging.h"
20
21 namespace plugin {
22 class Plugin;
23 }
24
25 struct PPP_InputEvent;
26
27 namespace ppapi_proxy {
28
29 class BrowserPpp {
30 public:
31 BrowserPpp(NaClSrpcChannel* main_channel, plugin::Plugin* plugin)
32 : main_channel_(main_channel),
33 is_nexe_alive_(true),
34 plugin_pid_(0),
35 plugin_(plugin),
36 ppp_instance_interface_(NULL),
37 ppp_messaging_interface_(NULL),
38 ppp_input_event_interface_(NULL) {
39 CHECK(main_channel_ != NULL);
40 }
41
42 ~BrowserPpp() {}
43
44 int32_t InitializeModule(PP_Module module_id,
45 PPB_GetInterface get_browser_interface);
46
47 // Joins upcall thread, drops references to channel (owned by plugin),
48 // calls plugin side shutdown, but not user's PPP_ShutdownModule.
49 void ShutdownModule();
50 // Returns an interface pointer or NULL.
51 const void* GetPluginInterface(const char* interface_name);
52 // Returns an interface pointer or fails on a NULL CHECK.
53 const void* GetPluginInterfaceSafe(const char* interface_name);
54
55 // Guaranteed to be non-NULL if module initialization succeeded.
56 // Use this instead of GetPluginInterface for PPP_INSTANCE_INTERFACE.
57 const PPP_Instance* ppp_instance_interface() const {
58 return ppp_instance_interface_;
59 }
60
61 const PPP_Messaging* ppp_messaging_interface() const {
62 return ppp_messaging_interface_;
63 }
64
65 const PPP_InputEvent* ppp_input_event_interface() const {
66 return ppp_input_event_interface_;
67 }
68
69 bool is_valid() const { return is_nexe_alive_; }
70 static bool is_valid(BrowserPpp* proxy) {
71 return (proxy != NULL && proxy->is_valid());
72 }
73
74 NaClSrpcChannel* main_channel() const { return main_channel_; }
75 int plugin_pid() const { return plugin_pid_; }
76 plugin::Plugin* plugin() { return plugin_; }
77
78 private:
79 // The "main" SRPC channel used to communicate with the plugin.
80 // NULL if proxy has been shut down.
81 NaClSrpcChannel* main_channel_;
82 bool is_nexe_alive_;
83 // The PID of the plugin.
84 int plugin_pid_;
85 // Plugin that owns this proxy.
86 plugin::Plugin* plugin_;
87
88 // Set on module initialization.
89 const PPP_Instance* ppp_instance_interface_;
90 const PPP_Messaging* ppp_messaging_interface_;
91 const PPP_InputEvent* ppp_input_event_interface_;
92
93 // The thread used to handle calls on other than the main thread.
94 struct NaClThread upcall_thread_;
95 NACL_DISALLOW_COPY_AND_ASSIGN(BrowserPpp);
96 };
97
98 } // namespace ppapi_proxy
99
100 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698