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

Side by Side Diff: src/trusted/plugin/module_ppapi.cc

Issue 7799028: Remove src/trusted/plugin (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: fix gyp file for necessary -I 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 | « src/trusted/plugin/method_map.cc ('k') | src/trusted/plugin/nacl_entry_points.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 #include "native_client/src/shared/platform/nacl_time.h"
8 #include "native_client/src/trusted/desc/nrd_all_modules.h"
9 #include "native_client/src/trusted/handle_pass/browser_handle.h"
10 #include "native_client/src/trusted/plugin/nacl_entry_points.h"
11 #include "native_client/src/trusted/plugin/plugin.h"
12
13 #include "ppapi/c/private/ppb_nacl_private.h"
14 #include "ppapi/cpp/module.h"
15
16 GetURandomFDFunc get_urandom_fd;
17
18 namespace plugin {
19
20 class ModulePpapi : public pp::Module {
21 public:
22 ModulePpapi() : pp::Module(), init_was_successful_(false) {
23 PLUGIN_PRINTF(("ModulePpapi::ModulePpapi (this=%p)\n",
24 static_cast<void*>(this)));
25 }
26
27 virtual ~ModulePpapi() {
28 if (init_was_successful_) {
29 NaClNrdAllModulesFini();
30 }
31 PLUGIN_PRINTF(("ModulePpapi::~ModulePpapi (this=%p)\n",
32 static_cast<void*>(this)));
33 }
34
35 virtual bool Init() {
36 // Ask the browser for an interface which provides missing functions
37 const PPB_NaCl_Private* ptr = reinterpret_cast<const PPB_NaCl_Private*>(
38 GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE));
39
40 if (NULL == ptr) {
41 PLUGIN_PRINTF(("ModulePpapi::Init failed: "
42 "GetBrowserInterface returned NULL\n"));
43 return false;
44 }
45
46 launch_nacl_process = reinterpret_cast<LaunchNaClProcessFunc>(
47 ptr->LaunchSelLdr);
48 get_urandom_fd = ptr->UrandomFD;
49
50 // In the plugin, we don't need high resolution time of day.
51 NaClAllowLowResolutionTimeOfDay();
52 NaClNrdAllModulesInit();
53
54 #if NACL_WINDOWS && !defined(NACL_STANDALONE)
55 NaClHandlePassBrowserInit();
56 #endif
57 init_was_successful_ = true;
58 return true;
59 }
60
61 virtual pp::Instance* CreateInstance(PP_Instance pp_instance) {
62 PLUGIN_PRINTF(("ModulePpapi::CreateInstance (pp_instance=%"NACL_PRId32")\n",
63 pp_instance));
64 Plugin* plugin = Plugin::New(pp_instance);
65 PLUGIN_PRINTF(("ModulePpapi::CreateInstance (return %p)\n",
66 static_cast<void* >(plugin)));
67 return plugin;
68 }
69
70 private:
71 bool init_was_successful_;
72 };
73
74 } // namespace plugin
75
76
77 namespace pp {
78
79 Module* CreateModule() {
80 PLUGIN_PRINTF(("CreateModule ()\n"));
81 return new plugin::ModulePpapi();
82 }
83
84 } // namespace pp
OLDNEW
« no previous file with comments | « src/trusted/plugin/method_map.cc ('k') | src/trusted/plugin/nacl_entry_points.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698