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

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

Issue 356053004: Pepper: Remove PPP_ManifestService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix declaration order Created 6 years, 5 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
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 #define NACL_LOG_MODULE_NAME "Plugin_ServiceRuntime" 7 #define NACL_LOG_MODULE_NAME "Plugin_ServiceRuntime"
8 8
9 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" 9 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h"
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "ppapi/native_client/src/trusted/plugin/plugin.h" 44 #include "ppapi/native_client/src/trusted/plugin/plugin.h"
45 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" 45 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h"
46 #include "ppapi/native_client/src/trusted/plugin/pnacl_resources.h" 46 #include "ppapi/native_client/src/trusted/plugin/pnacl_resources.h"
47 #include "ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h" 47 #include "ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h"
48 #include "ppapi/native_client/src/trusted/plugin/srpc_client.h" 48 #include "ppapi/native_client/src/trusted/plugin/srpc_client.h"
49 #include "ppapi/native_client/src/trusted/plugin/utility.h" 49 #include "ppapi/native_client/src/trusted/plugin/utility.h"
50 #include "ppapi/native_client/src/trusted/weak_ref/call_on_main_thread.h" 50 #include "ppapi/native_client/src/trusted/weak_ref/call_on_main_thread.h"
51 51
52 namespace plugin { 52 namespace plugin {
53 53
54 namespace {
55
56 class ManifestService {
57 public:
58 ManifestService(nacl::WeakRefAnchor* anchor,
59 PluginReverseInterface* plugin_reverse)
60 : anchor_(anchor),
61 plugin_reverse_(plugin_reverse) {
62 }
63
64 ~ManifestService() {
65 anchor_->Unref();
66 }
67
68 bool Quit() {
69 delete this;
70 return false;
71 }
72
73 bool StartupInitializationComplete() {
74 // Release this instance if the ServiceRuntime is already destructed.
75 if (anchor_->is_abandoned()) {
76 delete this;
77 return false;
78 }
79
80 plugin_reverse_->StartupInitializationComplete();
81 return true;
82 }
83
84 static PP_Bool QuitTrampoline(void* user_data) {
85 return PP_FromBool(static_cast<ManifestService*>(user_data)->Quit());
86 }
87
88 static PP_Bool StartupInitializationCompleteTrampoline(void* user_data) {
89 return PP_FromBool(static_cast<ManifestService*>(user_data)->
90 StartupInitializationComplete());
91 }
92
93 private:
94 // Weak reference to check if plugin_reverse is legally accessible or not.
95 nacl::WeakRefAnchor* anchor_;
96 PluginReverseInterface* plugin_reverse_;
97
98 DISALLOW_COPY_AND_ASSIGN(ManifestService);
99 };
100
101 // Vtable to pass functions to LaunchSelLdr.
102 const PPP_ManifestService kManifestServiceVTable = {
103 &ManifestService::QuitTrampoline,
104 &ManifestService::StartupInitializationCompleteTrampoline,
105 };
106
107 } // namespace
108
109 OpenManifestEntryResource::~OpenManifestEntryResource() { 54 OpenManifestEntryResource::~OpenManifestEntryResource() {
110 } 55 }
111 56
112 PluginReverseInterface::PluginReverseInterface( 57 PluginReverseInterface::PluginReverseInterface(
113 nacl::WeakRefAnchor* anchor, 58 nacl::WeakRefAnchor* anchor,
114 Plugin* plugin, 59 Plugin* plugin,
115 ServiceRuntime* service_runtime, 60 ServiceRuntime* service_runtime,
116 pp::CompletionCallback init_done_cb, 61 pp::CompletionCallback init_done_cb,
117 pp::CompletionCallback crash_cb) 62 pp::CompletionCallback crash_cb)
118 : anchor_(anchor), 63 : anchor_(anchor),
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 ErrorInfo error_info; 400 ErrorInfo error_info;
456 error_info.SetReport( 401 error_info.SetReport(
457 PP_NACL_ERROR_SEL_LDR_CREATE_LAUNCHER, 402 PP_NACL_ERROR_SEL_LDR_CREATE_LAUNCHER,
458 "ServiceRuntime: failed to create sel_ldr launcher"); 403 "ServiceRuntime: failed to create sel_ldr launcher");
459 plugin_->ReportLoadError(error_info); 404 plugin_->ReportLoadError(error_info);
460 } 405 }
461 pp::Module::Get()->core()->CallOnMainThread(0, callback, PP_ERROR_FAILED); 406 pp::Module::Get()->core()->CallOnMainThread(0, callback, PP_ERROR_FAILED);
462 return; 407 return;
463 } 408 }
464 409
465 ManifestService* manifest_service =
466 new ManifestService(anchor_->Ref(), rev_interface_);
467 bool enable_dev_interfaces = 410 bool enable_dev_interfaces =
468 GetNaClInterface()->DevInterfacesEnabled(plugin_->pp_instance()); 411 GetNaClInterface()->DevInterfacesEnabled(plugin_->pp_instance());
469 412
470 tmp_subprocess->Start(plugin_->pp_instance(), 413 tmp_subprocess->Start(plugin_->pp_instance(),
471 main_service_runtime_, 414 main_service_runtime_,
472 params.url.c_str(), 415 params.url.c_str(),
473 &params.file_info, 416 &params.file_info,
474 params.uses_irt, 417 params.uses_irt,
475 params.uses_ppapi, 418 params.uses_ppapi,
476 uses_nonsfi_mode_, 419 uses_nonsfi_mode_,
477 enable_dev_interfaces, 420 enable_dev_interfaces,
478 params.enable_dyncode_syscalls, 421 params.enable_dyncode_syscalls,
479 params.enable_exception_handling, 422 params.enable_exception_handling,
480 params.enable_crash_throttling, 423 params.enable_crash_throttling,
481 &kManifestServiceVTable,
482 manifest_service,
483 callback); 424 callback);
484 subprocess_.reset(tmp_subprocess.release()); 425 subprocess_.reset(tmp_subprocess.release());
485 } 426 }
486 427
487 bool ServiceRuntime::WaitForSelLdrStart() { 428 bool ServiceRuntime::WaitForSelLdrStart() {
488 // Time to wait on condvar (for browser to create a new sel_ldr process on 429 // Time to wait on condvar (for browser to create a new sel_ldr process on
489 // our behalf). Use 6 seconds to be *fairly* conservative. 430 // our behalf). Use 6 seconds to be *fairly* conservative.
490 // 431 //
491 // On surfaway, the CallOnMainThread above may never get scheduled 432 // On surfaway, the CallOnMainThread above may never get scheduled
492 // to unblock this condvar, or the IPC reply from the browser to renderer 433 // to unblock this condvar, or the IPC reply from the browser to renderer
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 630
690 nacl::string ServiceRuntime::GetCrashLogOutput() { 631 nacl::string ServiceRuntime::GetCrashLogOutput() {
691 if (NULL != subprocess_.get()) { 632 if (NULL != subprocess_.get()) {
692 return subprocess_->GetCrashLogOutput(); 633 return subprocess_->GetCrashLogOutput();
693 } else { 634 } else {
694 return std::string(); 635 return std::string();
695 } 636 }
696 } 637 }
697 638
698 } // namespace plugin 639 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698