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: components/nacl/renderer/plugin/module_ppapi.cc

Issue 1646733002: NaCl cleanup: Remove now-unneeded initialisation of NaCl libraries (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "components/nacl/renderer/plugin/module_ppapi.h" 7 #include "components/nacl/renderer/plugin/module_ppapi.h"
8 #include "components/nacl/renderer/plugin/plugin.h" 8 #include "components/nacl/renderer/plugin/plugin.h"
9 #include "components/nacl/renderer/plugin/utility.h" 9 #include "components/nacl/renderer/plugin/utility.h"
10 #include "native_client/src/shared/platform/nacl_secure_random.h"
11 #include "native_client/src/shared/platform/nacl_time.h"
12 #include "native_client/src/trusted/desc/nrd_all_modules.h"
13 10
14 namespace plugin { 11 namespace plugin {
15 12
16 ModulePpapi::ModulePpapi() : pp::Module(), 13 ModulePpapi::ModulePpapi() : pp::Module(),
17 init_was_successful_(false),
18 private_interface_(NULL) { 14 private_interface_(NULL) {
19 } 15 }
20 16
21 ModulePpapi::~ModulePpapi() { 17 ModulePpapi::~ModulePpapi() {
22 if (init_was_successful_) {
23 NaClNrdAllModulesFini();
24 }
25 } 18 }
26 19
27 bool ModulePpapi::Init() { 20 bool ModulePpapi::Init() {
28 // Ask the browser for an interface which provides missing functions 21 // Ask the browser for an interface which provides missing functions
29 private_interface_ = reinterpret_cast<const PPB_NaCl_Private*>( 22 private_interface_ = reinterpret_cast<const PPB_NaCl_Private*>(
30 GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE)); 23 GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE));
31 24
32 if (NULL == private_interface_) { 25 if (NULL == private_interface_) {
33 return false; 26 return false;
34 } 27 }
35 SetNaClInterface(private_interface_); 28 SetNaClInterface(private_interface_);
36 29
37 #if NACL_LINUX || NACL_OSX
38 // Note that currently we do not need random numbers inside the
39 // NaCl trusted plugin on Unix, but NaClSecureRngModuleInit() is
40 // strict and will raise a fatal error unless we provide it with a
41 // /dev/urandom FD beforehand.
42 NaClSecureRngModuleSetUrandomFd(dup(private_interface_->UrandomFD()));
43 #endif
44
45 // In the plugin, we don't need high resolution time of day.
46 NaClAllowLowResolutionTimeOfDay();
47 NaClNrdAllModulesInit();
48
49 init_was_successful_ = true;
50 return true; 30 return true;
51 } 31 }
52 32
53 pp::Instance* ModulePpapi::CreateInstance(PP_Instance pp_instance) { 33 pp::Instance* ModulePpapi::CreateInstance(PP_Instance pp_instance) {
54 return new Plugin(pp_instance); 34 return new Plugin(pp_instance);
55 } 35 }
56 36
57 } // namespace plugin 37 } // namespace plugin
58 38
59 39
60 namespace pp { 40 namespace pp {
61 41
62 Module* CreateModule() { 42 Module* CreateModule() {
63 return new plugin::ModulePpapi(); 43 return new plugin::ModulePpapi();
64 } 44 }
65 45
66 } // namespace pp 46 } // namespace pp
OLDNEW
« no previous file with comments | « components/nacl/renderer/plugin/module_ppapi.h ('k') | components/nacl/renderer/plugin/plugin.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698