| OLD | NEW |
| 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 "native_client/src/trusted/plugin/service_runtime.h" | 9 #include "native_client/src/trusted/plugin/service_runtime.h" |
| 10 | 10 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation( | 246 void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation( |
| 247 OpenManifestEntryResource* p, | 247 OpenManifestEntryResource* p, |
| 248 int32_t err) { | 248 int32_t err) { |
| 249 OpenManifestEntryResource *open_cont; | 249 OpenManifestEntryResource *open_cont; |
| 250 UNREFERENCED_PARAMETER(err); | 250 UNREFERENCED_PARAMETER(err); |
| 251 // CallOnMainThread continuations always called with err == PP_OK. | 251 // CallOnMainThread continuations always called with err == PP_OK. |
| 252 | 252 |
| 253 NaClLog(4, "Entered OpenManifestEntry_MainThreadContinuation\n"); | 253 NaClLog(4, "Entered OpenManifestEntry_MainThreadContinuation\n"); |
| 254 | 254 |
| 255 std::string mapped_url; | 255 std::string mapped_url; |
| 256 bool permit_extension_url = false; | 256 if (!manifest_->ResolveKey(p->url, &mapped_url, |
| 257 if (!manifest_->ResolveKey(p->url, &mapped_url, &permit_extension_url, | |
| 258 p->error_info, p->is_portable)) { | 257 p->error_info, p->is_portable)) { |
| 259 NaClLog(4, "OpenManifestEntry_MainThreadContinuation: ResolveKey failed\n"); | 258 NaClLog(4, "OpenManifestEntry_MainThreadContinuation: ResolveKey failed\n"); |
| 260 // Failed, and error_info has the details on what happened. Wake | 259 // Failed, and error_info has the details on what happened. Wake |
| 261 // up requesting thread -- we are done. | 260 // up requesting thread -- we are done. |
| 262 nacl::MutexLocker take(&mu_); | 261 nacl::MutexLocker take(&mu_); |
| 263 *p->op_complete_ptr = true; // done... | 262 *p->op_complete_ptr = true; // done... |
| 264 *p->out_desc = -1; // but failed. | 263 *p->out_desc = -1; // but failed. |
| 265 NaClXCondVarBroadcast(&cv_); | 264 NaClXCondVarBroadcast(&cv_); |
| 266 return; | 265 return; |
| 267 } | 266 } |
| 268 NaClLog(4, | 267 NaClLog(4, |
| 269 "OpenManifestEntry_MainThreadContinuation: ResolveKey: %s -> %s\n", | 268 "OpenManifestEntry_MainThreadContinuation: ResolveKey: %s -> %s\n", |
| 270 p->url.c_str(), mapped_url.c_str()); | 269 p->url.c_str(), mapped_url.c_str()); |
| 271 | 270 |
| 272 open_cont = new OpenManifestEntryResource(*p); // copy ctor! | 271 open_cont = new OpenManifestEntryResource(*p); // copy ctor! |
| 273 CHECK(open_cont != NULL); | 272 CHECK(open_cont != NULL); |
| 274 open_cont->url = mapped_url; | 273 open_cont->url = mapped_url; |
| 275 pp::CompletionCallback stream_cc = WeakRefNewCallback( | 274 pp::CompletionCallback stream_cc = WeakRefNewCallback( |
| 276 anchor_, | 275 anchor_, |
| 277 this, | 276 this, |
| 278 &PluginReverseInterface::StreamAsFile_MainThreadContinuation, | 277 &PluginReverseInterface::StreamAsFile_MainThreadContinuation, |
| 279 open_cont); | 278 open_cont); |
| 280 if (!plugin_->StreamAsFile(mapped_url, | 279 if (!plugin_->StreamAsFile(mapped_url, |
| 281 permit_extension_url, | |
| 282 stream_cc.pp_completion_callback())) { | 280 stream_cc.pp_completion_callback())) { |
| 283 NaClLog(4, | 281 NaClLog(4, |
| 284 "OpenManifestEntry_MainThreadContinuation: StreamAsFile failed\n"); | 282 "OpenManifestEntry_MainThreadContinuation: StreamAsFile failed\n"); |
| 285 nacl::MutexLocker take(&mu_); | 283 nacl::MutexLocker take(&mu_); |
| 286 *p->op_complete_ptr = true; // done... | 284 *p->op_complete_ptr = true; // done... |
| 287 *p->out_desc = -1; // but failed. | 285 *p->out_desc = -1; // but failed. |
| 288 p->error_info->SetReport(ERROR_MANIFEST_OPEN, | 286 p->error_info->SetReport(ERROR_MANIFEST_OPEN, |
| 289 "ServiceRuntime: StreamAsFile failed"); | 287 "ServiceRuntime: StreamAsFile failed"); |
| 290 NaClXCondVarBroadcast(&cv_); | 288 NaClXCondVarBroadcast(&cv_); |
| 291 return; | 289 return; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 nacl::MutexLocker take(&mu_); | 622 nacl::MutexLocker take(&mu_); |
| 625 return exit_status_; | 623 return exit_status_; |
| 626 } | 624 } |
| 627 | 625 |
| 628 void ServiceRuntime::set_exit_status(int exit_status) { | 626 void ServiceRuntime::set_exit_status(int exit_status) { |
| 629 nacl::MutexLocker take(&mu_); | 627 nacl::MutexLocker take(&mu_); |
| 630 exit_status_ = exit_status & 0xff; | 628 exit_status_ = exit_status & 0xff; |
| 631 } | 629 } |
| 632 | 630 |
| 633 } // namespace plugin | 631 } // namespace plugin |
| OLD | NEW |