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

Side by Side Diff: src/shared/ppapi_proxy/plugin_globals.cc

Issue 7605029: Extend IRT with nacl_irt_resource_open interface (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
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
« no previous file with comments | « no previous file | src/shared/ppapi_proxy/ppruntime.h » ('j') | src/untrusted/irt/irt.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. 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 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 #include <sys/nacl_imc_api.h> 5 #include <sys/nacl_imc_api.h>
6 #include <sys/nacl_syscalls.h> 6 #include <sys/nacl_syscalls.h>
7 7
8 #include "native_client/src/shared/platform/nacl_check.h" 8 #include "native_client/src/shared/platform/nacl_check.h"
9 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" 9 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h"
10 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h" 10 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 150
151 } // namespace ppapi_proxy 151 } // namespace ppapi_proxy
152 152
153 void PpapiPluginRegisterThreadCreator( 153 void PpapiPluginRegisterThreadCreator(
154 const struct PP_ThreadFunctions* new_funcs) { 154 const struct PP_ThreadFunctions* new_funcs) {
155 thread_funcs = *new_funcs; 155 thread_funcs = *new_funcs;
156 } 156 }
157 157
158 int PpapiPluginMain() { 158 // TODO(halyavin): this is needed for tests without IRT. They do not start
159 if (getenv("NACL_LD_ACCEPTS_PLUGIN_CONNECTION") != NULL) { 159 // in irt_entry.c where PpapiPluginPreInit is called.
Roland McGrath 2011/08/16 17:32:50 This comment refers to a function that does not ex
halyavin 2011/08/16 18:06:25 Done.
160 // Send a message to the page to ask it to reinitialise the 160 static int initialized = 0;
161 // plugin's SRPC/PPAPI connection. This triggers a call to
162 // __startSrpcServices() which in turn calls
163 // StartProxiedExecution() which sets up the PPAPI proxy. This is
164 // necessary because LoadNaClModule()'s earlier call to
165 // StartSrpcServices() was matched by the dynamic linker before
166 // libppruntime was available.
167 // For background, see:
168 // http://code.google.com/p/nativeclient/issues/detail?id=617
169 // http://code.google.com/p/nativeclient/issues/detail?id=1501
170 // TODO(mseaborn): This is a temporary measure. Find a less hacky
171 // way to do this.
172 struct NaClImcMsgIoVec iov = { const_cast<char*>("Init"), 4 };
173 struct NaClImcMsgHdr message = { &iov, 1, NULL, 0, 0 };
174 imc_sendmsg(NACL_SEND_FD, &message, 0);
175 }
176 161
162 int IrtInit() {
177 if (!NaClSrpcModuleInit()) { 163 if (!NaClSrpcModuleInit()) {
178 return 1; 164 return 1;
179 } 165 }
180 NaClLogModuleInit(); // Enable NaClLog'ing used by CHECK(). 166 NaClLogModuleInit(); // Enable NaClLog'ing used by CHECK().
167 initialized = 1;
168 return 0;
169 }
170
171 int PpapiPluginMain() {
172 if (!initialized) {
Roland McGrath 2011/08/16 17:32:50 This is not thread-safe, which could be a problem
halyavin 2011/08/16 18:06:25 This will be changed, if we implement lazy initial
173 int status = IrtInit();
174 if (0 != status) {
175 return status;
176 }
177 }
181 PpapiPluginRegisterDefaultThreadCreator(); 178 PpapiPluginRegisterDefaultThreadCreator();
182 // Designate this as the main thread for PPB_Core::IsMainThread(). 179 // Designate this as the main thread for PPB_Core::IsMainThread().
183 ppapi_proxy::PluginCore::MarkMainThread(); 180 ppapi_proxy::PluginCore::MarkMainThread();
184 if (!NaClSrpcAcceptClientConnection(PppRpcs::srpc_methods)) { 181 if (!NaClSrpcAcceptClientConnection(PppRpcs::srpc_methods)) {
185 return 1; 182 return 1;
186 } 183 }
187 NaClSrpcModuleFini(); 184 NaClSrpcModuleFini();
188 185
189 return 0; 186 return 0;
190 } 187 }
OLDNEW
« no previous file with comments | « no previous file | src/shared/ppapi_proxy/ppruntime.h » ('j') | src/untrusted/irt/irt.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698