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

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

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

Powered by Google App Engine
This is Rietveld 408576698