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

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

Issue 301013002: Pepper: Manifest ID cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix type signature Created 6 years, 6 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return; 179 return;
180 180
181 callback->Run(pp_error); 181 callback->Run(pp_error);
182 delete callback; 182 delete callback;
183 callback = NULL; 183 callback = NULL;
184 } 184 }
185 185
186 PluginReverseInterface::PluginReverseInterface( 186 PluginReverseInterface::PluginReverseInterface(
187 nacl::WeakRefAnchor* anchor, 187 nacl::WeakRefAnchor* anchor,
188 Plugin* plugin, 188 Plugin* plugin,
189 int32_t manifest_id,
190 ServiceRuntime* service_runtime, 189 ServiceRuntime* service_runtime,
191 pp::CompletionCallback init_done_cb, 190 pp::CompletionCallback init_done_cb,
192 pp::CompletionCallback crash_cb) 191 pp::CompletionCallback crash_cb)
193 : anchor_(anchor), 192 : anchor_(anchor),
194 plugin_(plugin), 193 plugin_(plugin),
195 manifest_id_(manifest_id),
196 service_runtime_(service_runtime), 194 service_runtime_(service_runtime),
197 shutting_down_(false), 195 shutting_down_(false),
198 init_done_cb_(init_done_cb), 196 init_done_cb_(init_done_cb),
199 crash_cb_(crash_cb) { 197 crash_cb_(crash_cb) {
200 NaClXMutexCtor(&mu_); 198 NaClXMutexCtor(&mu_);
201 NaClXCondVarCtor(&cv_); 199 NaClXCondVarCtor(&cv_);
202 } 200 }
203 201
204 PluginReverseInterface::~PluginReverseInterface() { 202 PluginReverseInterface::~PluginReverseInterface() {
205 NaClCondVarDtor(&cv_); 203 NaClCondVarDtor(&cv_);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation( 312 void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation(
315 OpenManifestEntryResource* p, 313 OpenManifestEntryResource* p,
316 int32_t err) { 314 int32_t err) {
317 UNREFERENCED_PARAMETER(err); 315 UNREFERENCED_PARAMETER(err);
318 // CallOnMainThread continuations always called with err == PP_OK. 316 // CallOnMainThread continuations always called with err == PP_OK.
319 317
320 NaClLog(4, "Entered OpenManifestEntry_MainThreadContinuation\n"); 318 NaClLog(4, "Entered OpenManifestEntry_MainThreadContinuation\n");
321 319
322 PP_Var pp_mapped_url; 320 PP_Var pp_mapped_url;
323 PP_PNaClOptions pnacl_options = {PP_FALSE, PP_FALSE, 2}; 321 PP_PNaClOptions pnacl_options = {PP_FALSE, PP_FALSE, 2};
324 if (!GetNaClInterface()->ManifestResolveKey(plugin_->pp_instance(), 322 if (!GetNaClInterface()->ManifestResolveKey(
325 manifest_id_, 323 plugin_->pp_instance(),
326 p->url.c_str(), 324 PP_FromBool(!service_runtime_->main_service_runtime()),
327 &pp_mapped_url, 325 p->url.c_str(),
328 &pnacl_options)) { 326 &pp_mapped_url,
327 &pnacl_options)) {
329 NaClLog(4, "OpenManifestEntry_MainThreadContinuation: ResolveKey failed\n"); 328 NaClLog(4, "OpenManifestEntry_MainThreadContinuation: ResolveKey failed\n");
330 // Failed, and error_info has the details on what happened. Wake 329 // Failed, and error_info has the details on what happened. Wake
331 // up requesting thread -- we are done. 330 // up requesting thread -- we are done.
332 { 331 {
333 nacl::MutexLocker take(&mu_); 332 nacl::MutexLocker take(&mu_);
334 *p->op_complete_ptr = true; // done... 333 *p->op_complete_ptr = true; // done...
335 p->file_info->desc = -1; // but failed. 334 p->file_info->desc = -1; // but failed.
336 NaClXCondVarBroadcast(&cv_); 335 NaClXCondVarBroadcast(&cv_);
337 } 336 }
338 p->MaybeRunCallback(PP_OK); 337 p->MaybeRunCallback(PP_OK);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 void PluginReverseInterface::ReportExitStatus(int exit_status) { 461 void PluginReverseInterface::ReportExitStatus(int exit_status) {
463 service_runtime_->set_exit_status(exit_status); 462 service_runtime_->set_exit_status(exit_status);
464 } 463 }
465 464
466 int64_t PluginReverseInterface::RequestQuotaForWrite( 465 int64_t PluginReverseInterface::RequestQuotaForWrite(
467 nacl::string file_id, int64_t offset, int64_t bytes_to_write) { 466 nacl::string file_id, int64_t offset, int64_t bytes_to_write) {
468 return bytes_to_write; 467 return bytes_to_write;
469 } 468 }
470 469
471 ServiceRuntime::ServiceRuntime(Plugin* plugin, 470 ServiceRuntime::ServiceRuntime(Plugin* plugin,
472 int32_t manifest_id,
473 bool main_service_runtime, 471 bool main_service_runtime,
474 bool uses_nonsfi_mode, 472 bool uses_nonsfi_mode,
475 pp::CompletionCallback init_done_cb, 473 pp::CompletionCallback init_done_cb,
476 pp::CompletionCallback crash_cb) 474 pp::CompletionCallback crash_cb)
477 : plugin_(plugin), 475 : plugin_(plugin),
478 main_service_runtime_(main_service_runtime), 476 main_service_runtime_(main_service_runtime),
479 uses_nonsfi_mode_(uses_nonsfi_mode), 477 uses_nonsfi_mode_(uses_nonsfi_mode),
480 reverse_service_(NULL), 478 reverse_service_(NULL),
481 anchor_(new nacl::WeakRefAnchor()), 479 anchor_(new nacl::WeakRefAnchor()),
482 rev_interface_(new PluginReverseInterface(anchor_, plugin, 480 rev_interface_(new PluginReverseInterface(anchor_, plugin, this,
483 manifest_id,
484 this,
485 init_done_cb, crash_cb)), 481 init_done_cb, crash_cb)),
486 start_sel_ldr_done_(false) { 482 start_sel_ldr_done_(false) {
487 NaClSrpcChannelInitialize(&command_channel_); 483 NaClSrpcChannelInitialize(&command_channel_);
488 NaClXMutexCtor(&mu_); 484 NaClXMutexCtor(&mu_);
489 NaClXCondVarCtor(&cond_); 485 NaClXCondVarCtor(&cond_);
490 } 486 }
491 487
492 bool ServiceRuntime::SetupCommandChannel() { 488 bool ServiceRuntime::SetupCommandChannel() {
493 NaClLog(4, "ServiceRuntime::SetupCommand (this=%p, subprocess=%p)\n", 489 NaClLog(4, "ServiceRuntime::SetupCommand (this=%p, subprocess=%p)\n",
494 static_cast<void*>(this), 490 static_cast<void*>(this),
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 805
810 nacl::string ServiceRuntime::GetCrashLogOutput() { 806 nacl::string ServiceRuntime::GetCrashLogOutput() {
811 if (NULL != subprocess_.get()) { 807 if (NULL != subprocess_.get()) {
812 return subprocess_->GetCrashLogOutput(); 808 return subprocess_->GetCrashLogOutput();
813 } else { 809 } else {
814 return std::string(); 810 return std::string();
815 } 811 }
816 } 812 }
817 813
818 } // namespace plugin 814 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698