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

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

Issue 793723006: Revert of NaCl: Remove reliance on "init_done" SRPC call in the non-PNaCl case (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/plugin.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 "ppapi/native_client/src/trusted/plugin/plugin.h" 5 #include "ppapi/native_client/src/trusted/plugin/plugin.h"
6 6
7 #include <sys/stat.h> 7 #include <sys/stat.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 return true; 302 return true;
303 } 303 }
304 304
305 void Plugin::NexeFileDidOpen(int32_t pp_error) { 305 void Plugin::NexeFileDidOpen(int32_t pp_error) {
306 if (pp_error != PP_OK) 306 if (pp_error != PP_OK)
307 return; 307 return;
308 LoadNaClModule( 308 LoadNaClModule(
309 nexe_file_info_, 309 nexe_file_info_,
310 uses_nonsfi_mode_, 310 uses_nonsfi_mode_,
311 PP_NATIVE_NACL_PROCESS_TYPE, 311 PP_NATIVE_NACL_PROCESS_TYPE,
312 // No-op callback. 312 callback_factory_.NewCallback(&Plugin::NexeFileDidOpenContinuation));
313 pp::CompletionCallback()); 313 }
314
315 void Plugin::NexeFileDidOpenContinuation(int32_t pp_error) {
316 UNREFERENCED_PARAMETER(pp_error);
317 NaClLog(4, "Entered NexeFileDidOpenContinuation\n");
318 if (LoadNaClModuleContinuationIntern()) {
319 NaClLog(4, "NexeFileDidOpenContinuation: success;"
320 " setting histograms\n");
321 int64_t nexe_size = nacl_interface_->GetNexeSize(pp_instance());
322 nacl_interface_->ReportLoadSuccess(
323 pp_instance(), nexe_size, nexe_size);
324 } else {
325 NaClLog(4, "NexeFileDidOpenContinuation: failed.");
326 }
327 NaClLog(4, "Leaving NexeFileDidOpenContinuation\n");
314 } 328 }
315 329
316 void Plugin::BitcodeDidTranslate(int32_t pp_error) { 330 void Plugin::BitcodeDidTranslate(int32_t pp_error) {
317 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate (pp_error=%" NACL_PRId32 ")\n", 331 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate (pp_error=%" NACL_PRId32 ")\n",
318 pp_error)); 332 pp_error));
319 if (pp_error != PP_OK) { 333 if (pp_error != PP_OK) {
320 // Error should have been reported by pnacl. Just return. 334 // Error should have been reported by pnacl. Just return.
321 return; 335 return;
322 } 336 }
323 337
324 // Inform JavaScript that we successfully translated the bitcode to a nexe. 338 // Inform JavaScript that we successfully translated the bitcode to a nexe.
325 PP_FileHandle handle = pnacl_coordinator_->TakeTranslatedFileHandle(); 339 PP_FileHandle handle = pnacl_coordinator_->TakeTranslatedFileHandle();
326 340
327 PP_NaClFileInfo info; 341 PP_NaClFileInfo info;
328 info.handle = handle; 342 info.handle = handle;
329 info.token_lo = 0; 343 info.token_lo = 0;
330 info.token_hi = 0; 344 info.token_hi = 0;
331 LoadNaClModule( 345 LoadNaClModule(
332 info, 346 info,
333 false, /* uses_nonsfi_mode */ 347 false, /* uses_nonsfi_mode */
334 PP_PNACL_PROCESS_TYPE, 348 PP_PNACL_PROCESS_TYPE,
335 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslateContinuation)); 349 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslateContinuation));
336 } 350 }
337 351
338 // This is the only code path that responds to the
339 // "init_done"/StartupInitializationComplete() SRPC call, which now has an
340 // effect for PNaCl only.
341 // TODO(mseaborn): Switch to doing this ReportLoadSuccess() call via the
342 // Chrome-IPC-based StartupInitializationComplete() handler in
343 // ppb_nacl_private_impl.cc, to match the non-PNaCl cases.
344 void Plugin::BitcodeDidTranslateContinuation(int32_t pp_error) { 352 void Plugin::BitcodeDidTranslateContinuation(int32_t pp_error) {
345 NaClLog(4, "Entered BitcodeDidTranslateContinuation\n"); 353 NaClLog(4, "Entered BitcodeDidTranslateContinuation\n");
346 UNREFERENCED_PARAMETER(pp_error); 354 UNREFERENCED_PARAMETER(pp_error);
347 if (LoadNaClModuleContinuationIntern()) { 355 if (LoadNaClModuleContinuationIntern()) {
348 int64_t loaded; 356 int64_t loaded;
349 int64_t total; 357 int64_t total;
350 // TODO(teravest): Tighten this up so we can get rid of 358 // TODO(teravest): Tighten this up so we can get rid of
351 // GetCurrentProgress(). loaded should always equal total. 359 // GetCurrentProgress(). loaded should always equal total.
352 pnacl_coordinator_->GetCurrentProgress(&loaded, &total); 360 pnacl_coordinator_->GetCurrentProgress(&loaded, &total);
353 nacl_interface_->ReportLoadSuccess(pp_instance(), loaded, total); 361 nacl_interface_->ReportLoadSuccess(pp_instance(), loaded, total);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 400 }
393 } 401 }
394 402
395 void Plugin::ReportLoadError(const ErrorInfo& error_info) { 403 void Plugin::ReportLoadError(const ErrorInfo& error_info) {
396 nacl_interface_->ReportLoadError(pp_instance(), 404 nacl_interface_->ReportLoadError(pp_instance(),
397 error_info.error_code(), 405 error_info.error_code(),
398 error_info.message().c_str()); 406 error_info.message().c_str());
399 } 407 }
400 408
401 } // namespace plugin 409 } // namespace plugin
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698