| 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 "ppapi/native_client/src/trusted/plugin/service_runtime.h" | 9 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 #include "ppapi/native_client/src/trusted/plugin/manifest.h" | 50 #include "ppapi/native_client/src/trusted/plugin/manifest.h" |
| 51 #include "ppapi/native_client/src/trusted/plugin/plugin.h" | 51 #include "ppapi/native_client/src/trusted/plugin/plugin.h" |
| 52 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" | 52 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" |
| 53 #include "ppapi/native_client/src/trusted/plugin/pnacl_resources.h" | 53 #include "ppapi/native_client/src/trusted/plugin/pnacl_resources.h" |
| 54 #include "ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h" | 54 #include "ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h" |
| 55 #include "ppapi/native_client/src/trusted/plugin/srpc_client.h" | 55 #include "ppapi/native_client/src/trusted/plugin/srpc_client.h" |
| 56 #include "ppapi/native_client/src/trusted/weak_ref/call_on_main_thread.h" | 56 #include "ppapi/native_client/src/trusted/weak_ref/call_on_main_thread.h" |
| 57 | 57 |
| 58 namespace plugin { | 58 namespace plugin { |
| 59 |
| 60 class OpenManifestEntryAsyncCallback { |
| 61 public: |
| 62 OpenManifestEntryAsyncCallback(PP_OpenResourceCompletionCallback callback, |
| 63 void* callback_user_data) |
| 64 : callback_(callback), callback_user_data_(callback_user_data) { |
| 65 } |
| 66 |
| 67 ~OpenManifestEntryAsyncCallback() { |
| 68 if (callback_) |
| 69 callback_(callback_user_data_, PP_kInvalidFileHandle); |
| 70 } |
| 71 |
| 72 void Run(int32_t pp_error) { |
| 73 #if defined(OS_WIN) |
| 74 // Currently, this is used only for non-SFI mode, and now the mode is not |
| 75 // supported on windows. |
| 76 // TODO(hidehiko): Support it on Windows when we switch to use |
| 77 // ManifestService also in SFI-mode. |
| 78 NACL_NOTREACHED(); |
| 79 #elif defined(OS_POSIX) |
| 80 // On posix, PlatformFile is the file descriptor. |
| 81 callback_(callback_user_data_, (pp_error == PP_OK) ? info_.desc : -1); |
| 82 callback_ = NULL; |
| 83 #endif |
| 84 } |
| 85 |
| 86 NaClFileInfo* mutable_info() { return &info_; } |
| 87 |
| 88 private: |
| 89 NaClFileInfo info_; |
| 90 PP_OpenResourceCompletionCallback callback_; |
| 91 void* callback_user_data_; |
| 92 DISALLOW_COPY_AND_ASSIGN(OpenManifestEntryAsyncCallback); |
| 93 }; |
| 94 |
| 59 namespace { | 95 namespace { |
| 60 | 96 |
| 61 // For doing crude quota enforcement on writes to temp files. | 97 // For doing crude quota enforcement on writes to temp files. |
| 62 // We do not allow a temp file bigger than 128 MB for now. | 98 // We do not allow a temp file bigger than 128 MB for now. |
| 63 // There is currently a limit of 32M for nexe text size, so 128M | 99 // There is currently a limit of 32M for nexe text size, so 128M |
| 64 // should be plenty for static data | 100 // should be plenty for static data |
| 65 const int64_t kMaxTempQuota = 0x8000000; | 101 const int64_t kMaxTempQuota = 0x8000000; |
| 66 | 102 |
| 67 class ManifestService { | 103 class ManifestService { |
| 68 public: | 104 public: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 85 // Release this instance if the ServiceRuntime is already destructed. | 121 // Release this instance if the ServiceRuntime is already destructed. |
| 86 if (anchor_->is_abandoned()) { | 122 if (anchor_->is_abandoned()) { |
| 87 delete this; | 123 delete this; |
| 88 return false; | 124 return false; |
| 89 } | 125 } |
| 90 | 126 |
| 91 plugin_reverse_->StartupInitializationComplete(); | 127 plugin_reverse_->StartupInitializationComplete(); |
| 92 return true; | 128 return true; |
| 93 } | 129 } |
| 94 | 130 |
| 131 bool OpenResource(const char* entry_key, |
| 132 PP_OpenResourceCompletionCallback callback, |
| 133 void* callback_user_data) { |
| 134 // Release this instance if the ServiceRuntime is already destructed. |
| 135 if (anchor_->is_abandoned()) { |
| 136 callback(callback_user_data, PP_kInvalidFileHandle); |
| 137 delete this; |
| 138 return false; |
| 139 } |
| 140 |
| 141 OpenManifestEntryAsyncCallback* open_manifest_callback = |
| 142 new OpenManifestEntryAsyncCallback(callback, callback_user_data); |
| 143 plugin_reverse_->OpenManifestEntryAsync( |
| 144 entry_key, |
| 145 open_manifest_callback->mutable_info(), |
| 146 open_manifest_callback); |
| 147 return true; |
| 148 } |
| 149 |
| 95 static PP_Bool QuitTrampoline(void* user_data) { | 150 static PP_Bool QuitTrampoline(void* user_data) { |
| 96 return PP_FromBool(static_cast<ManifestService*>(user_data)->Quit()); | 151 return PP_FromBool(static_cast<ManifestService*>(user_data)->Quit()); |
| 97 } | 152 } |
| 98 | 153 |
| 99 static PP_Bool StartupInitializationCompleteTrampoline(void* user_data) { | 154 static PP_Bool StartupInitializationCompleteTrampoline(void* user_data) { |
| 100 return PP_FromBool(static_cast<ManifestService*>(user_data)-> | 155 return PP_FromBool(static_cast<ManifestService*>(user_data)-> |
| 101 StartupInitializationComplete()); | 156 StartupInitializationComplete()); |
| 102 } | 157 } |
| 103 | 158 |
| 159 static PP_Bool OpenResourceTrampoline( |
| 160 void* user_data, |
| 161 const char* entry_key, |
| 162 PP_OpenResourceCompletionCallback callback, |
| 163 void* callback_user_data) { |
| 164 return PP_FromBool(static_cast<ManifestService*>(user_data)->OpenResource( |
| 165 entry_key, callback, callback_user_data)); |
| 166 } |
| 167 |
| 104 private: | 168 private: |
| 105 // Weak reference to check if plugin_reverse is legally accessible or not. | 169 // Weak reference to check if plugin_reverse is legally accessible or not. |
| 106 nacl::WeakRefAnchor* anchor_; | 170 nacl::WeakRefAnchor* anchor_; |
| 107 PluginReverseInterface* plugin_reverse_; | 171 PluginReverseInterface* plugin_reverse_; |
| 108 | 172 |
| 109 DISALLOW_COPY_AND_ASSIGN(ManifestService); | 173 DISALLOW_COPY_AND_ASSIGN(ManifestService); |
| 110 }; | 174 }; |
| 111 | 175 |
| 112 // Vtable to pass functions to LaunchSelLdr. | 176 // Vtable to pass functions to LaunchSelLdr. |
| 113 const PP_ManifestService kManifestServiceVTable = { | 177 const PPP_ManifestService kManifestServiceVTable = { |
| 114 &ManifestService::QuitTrampoline, | 178 &ManifestService::QuitTrampoline, |
| 115 &ManifestService::StartupInitializationCompleteTrampoline, | 179 &ManifestService::StartupInitializationCompleteTrampoline, |
| 180 &ManifestService::OpenResourceTrampoline, |
| 116 }; | 181 }; |
| 117 | 182 |
| 118 } // namespace | 183 } // namespace |
| 119 | 184 |
| 185 OpenManifestEntryResource::~OpenManifestEntryResource() { |
| 186 MaybeRunCallback(PP_ERROR_ABORTED); |
| 187 } |
| 188 |
| 189 void OpenManifestEntryResource::MaybeRunCallback(int32_t pp_error) { |
| 190 if (!callback) |
| 191 return; |
| 192 |
| 193 callback->Run(pp_error); |
| 194 delete callback; |
| 195 callback = NULL; |
| 196 } |
| 197 |
| 120 PluginReverseInterface::PluginReverseInterface( | 198 PluginReverseInterface::PluginReverseInterface( |
| 121 nacl::WeakRefAnchor* anchor, | 199 nacl::WeakRefAnchor* anchor, |
| 122 Plugin* plugin, | 200 Plugin* plugin, |
| 123 const Manifest* manifest, | 201 const Manifest* manifest, |
| 124 ServiceRuntime* service_runtime, | 202 ServiceRuntime* service_runtime, |
| 125 pp::CompletionCallback init_done_cb, | 203 pp::CompletionCallback init_done_cb, |
| 126 pp::CompletionCallback crash_cb) | 204 pp::CompletionCallback crash_cb) |
| 127 : anchor_(anchor), | 205 : anchor_(anchor), |
| 128 plugin_(plugin), | 206 plugin_(plugin), |
| 129 manifest_(manifest), | 207 manifest_(manifest), |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // and invoke StreamAsFile with a completion callback that invokes | 266 // and invoke StreamAsFile with a completion callback that invokes |
| 189 // GetPOSIXFileDesc. | 267 // GetPOSIXFileDesc. |
| 190 bool PluginReverseInterface::OpenManifestEntry(nacl::string url_key, | 268 bool PluginReverseInterface::OpenManifestEntry(nacl::string url_key, |
| 191 struct NaClFileInfo* info) { | 269 struct NaClFileInfo* info) { |
| 192 bool op_complete = false; // NB: mu_ and cv_ also controls access to this! | 270 bool op_complete = false; // NB: mu_ and cv_ also controls access to this! |
| 193 // The to_open object is owned by the weak ref callback. Because this function | 271 // The to_open object is owned by the weak ref callback. Because this function |
| 194 // waits for the callback to finish, the to_open object will be deallocated on | 272 // waits for the callback to finish, the to_open object will be deallocated on |
| 195 // the main thread before this function can return. The pointers it contains | 273 // the main thread before this function can return. The pointers it contains |
| 196 // to stack variables will not leak. | 274 // to stack variables will not leak. |
| 197 OpenManifestEntryResource* to_open = | 275 OpenManifestEntryResource* to_open = |
| 198 new OpenManifestEntryResource(url_key, info, &op_complete); | 276 new OpenManifestEntryResource(url_key, info, &op_complete, NULL); |
| 199 CHECK(to_open != NULL); | 277 CHECK(to_open != NULL); |
| 200 NaClLog(4, "PluginReverseInterface::OpenManifestEntry: %s\n", | 278 NaClLog(4, "PluginReverseInterface::OpenManifestEntry: %s\n", |
| 201 url_key.c_str()); | 279 url_key.c_str()); |
| 202 // This assumes we are not on the main thread. If false, we deadlock. | 280 // This assumes we are not on the main thread. If false, we deadlock. |
| 203 plugin::WeakRefCallOnMainThread( | 281 plugin::WeakRefCallOnMainThread( |
| 204 anchor_, | 282 anchor_, |
| 205 0, | 283 0, |
| 206 this, | 284 this, |
| 207 &plugin::PluginReverseInterface::OpenManifestEntry_MainThreadContinuation, | 285 &plugin::PluginReverseInterface::OpenManifestEntry_MainThreadContinuation, |
| 208 to_open); | 286 to_open); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 238 if (info->desc == -1) { | 316 if (info->desc == -1) { |
| 239 // TODO(bsy,ncbray): what else should we do with the error? This | 317 // TODO(bsy,ncbray): what else should we do with the error? This |
| 240 // is a runtime error that may simply be a programming error in | 318 // is a runtime error that may simply be a programming error in |
| 241 // the untrusted code, or it may be something else wrong w/ the | 319 // the untrusted code, or it may be something else wrong w/ the |
| 242 // manifest. | 320 // manifest. |
| 243 NaClLog(4, "OpenManifestEntry: failed for key %s", url_key.c_str()); | 321 NaClLog(4, "OpenManifestEntry: failed for key %s", url_key.c_str()); |
| 244 } | 322 } |
| 245 return true; | 323 return true; |
| 246 } | 324 } |
| 247 | 325 |
| 326 void PluginReverseInterface::OpenManifestEntryAsync( |
| 327 const nacl::string& entry_key, |
| 328 struct NaClFileInfo* info, |
| 329 OpenManifestEntryAsyncCallback* callback) { |
| 330 bool op_complete = false; |
| 331 OpenManifestEntryResource to_open( |
| 332 entry_key, info, &op_complete, callback); |
| 333 OpenManifestEntry_MainThreadContinuation(&to_open, PP_OK); |
| 334 } |
| 335 |
| 248 // Transfer point from OpenManifestEntry() which runs on the main thread | 336 // Transfer point from OpenManifestEntry() which runs on the main thread |
| 249 // (Some PPAPI actions -- like StreamAsFile -- can only run on the main thread). | 337 // (Some PPAPI actions -- like StreamAsFile -- can only run on the main thread). |
| 250 // OpenManifestEntry() is waiting on a condvar for this continuation to | 338 // OpenManifestEntry() is waiting on a condvar for this continuation to |
| 251 // complete. We Broadcast and awaken OpenManifestEntry() whenever we are done | 339 // complete. We Broadcast and awaken OpenManifestEntry() whenever we are done |
| 252 // either here, or in a later MainThreadContinuation step, if there are | 340 // either here, or in a later MainThreadContinuation step, if there are |
| 253 // multiple steps. | 341 // multiple steps. |
| 254 void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation( | 342 void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation( |
| 255 OpenManifestEntryResource* p, | 343 OpenManifestEntryResource* p, |
| 256 int32_t err) { | 344 int32_t err) { |
| 257 UNREFERENCED_PARAMETER(err); | 345 UNREFERENCED_PARAMETER(err); |
| 258 // CallOnMainThread continuations always called with err == PP_OK. | 346 // CallOnMainThread continuations always called with err == PP_OK. |
| 259 | 347 |
| 260 NaClLog(4, "Entered OpenManifestEntry_MainThreadContinuation\n"); | 348 NaClLog(4, "Entered OpenManifestEntry_MainThreadContinuation\n"); |
| 261 | 349 |
| 262 std::string mapped_url; | 350 std::string mapped_url; |
| 263 PP_PNaClOptions pnacl_options = {PP_FALSE, PP_FALSE, 2}; | 351 PP_PNaClOptions pnacl_options = {PP_FALSE, PP_FALSE, 2}; |
| 264 if (!manifest_->ResolveKey(p->url, &mapped_url, &pnacl_options)) { | 352 if (!manifest_->ResolveKey(p->url, &mapped_url, &pnacl_options)) { |
| 265 NaClLog(4, "OpenManifestEntry_MainThreadContinuation: ResolveKey failed\n"); | 353 NaClLog(4, "OpenManifestEntry_MainThreadContinuation: ResolveKey failed\n"); |
| 266 // Failed, and error_info has the details on what happened. Wake | 354 // Failed, and error_info has the details on what happened. Wake |
| 267 // up requesting thread -- we are done. | 355 // up requesting thread -- we are done. |
| 268 nacl::MutexLocker take(&mu_); | 356 { |
| 269 *p->op_complete_ptr = true; // done... | 357 nacl::MutexLocker take(&mu_); |
| 270 p->file_info->desc = -1; // but failed. | 358 *p->op_complete_ptr = true; // done... |
| 271 NaClXCondVarBroadcast(&cv_); | 359 p->file_info->desc = -1; // but failed. |
| 360 NaClXCondVarBroadcast(&cv_); |
| 361 } |
| 362 p->MaybeRunCallback(PP_OK); |
| 272 return; | 363 return; |
| 273 } | 364 } |
| 274 NaClLog(4, | 365 NaClLog(4, |
| 275 "OpenManifestEntry_MainThreadContinuation: " | 366 "OpenManifestEntry_MainThreadContinuation: " |
| 276 "ResolveKey: %s -> %s (pnacl_translate(%d))\n", | 367 "ResolveKey: %s -> %s (pnacl_translate(%d))\n", |
| 277 p->url.c_str(), mapped_url.c_str(), pnacl_options.translate); | 368 p->url.c_str(), mapped_url.c_str(), pnacl_options.translate); |
| 278 | 369 |
| 279 if (pnacl_options.translate) { | 370 if (pnacl_options.translate) { |
| 280 // Requires PNaCl translation, but that's not supported. | 371 // Requires PNaCl translation, but that's not supported. |
| 281 NaClLog(4, | 372 NaClLog(4, |
| 282 "OpenManifestEntry_MainThreadContinuation: " | 373 "OpenManifestEntry_MainThreadContinuation: " |
| 283 "Requires PNaCl translation -- not supported\n"); | 374 "Requires PNaCl translation -- not supported\n"); |
| 284 nacl::MutexLocker take(&mu_); | 375 { |
| 285 *p->op_complete_ptr = true; // done... | 376 nacl::MutexLocker take(&mu_); |
| 286 p->file_info->desc = -1; // but failed. | 377 *p->op_complete_ptr = true; // done... |
| 287 NaClXCondVarBroadcast(&cv_); | 378 p->file_info->desc = -1; // but failed. |
| 379 NaClXCondVarBroadcast(&cv_); |
| 380 } |
| 381 p->MaybeRunCallback(PP_OK); |
| 288 return; | 382 return; |
| 289 } | 383 } |
| 290 | 384 |
| 291 if (PnaclUrls::IsPnaclComponent(mapped_url)) { | 385 if (PnaclUrls::IsPnaclComponent(mapped_url)) { |
| 292 // Special PNaCl support files, that are installed on the | 386 // Special PNaCl support files, that are installed on the |
| 293 // user machine. | 387 // user machine. |
| 294 int32_t fd = PnaclResources::GetPnaclFD( | 388 int32_t fd = PnaclResources::GetPnaclFD( |
| 295 plugin_, | 389 plugin_, |
| 296 PnaclUrls::PnaclComponentURLToFilename(mapped_url).c_str()); | 390 PnaclUrls::PnaclComponentURLToFilename(mapped_url).c_str()); |
| 297 if (fd < 0) { | 391 if (fd < 0) { |
| 298 // We checked earlier if the pnacl component wasn't installed | 392 // We checked earlier if the pnacl component wasn't installed |
| 299 // yet, so this shouldn't happen. At this point, we can't do much | 393 // yet, so this shouldn't happen. At this point, we can't do much |
| 300 // anymore, so just continue with an invalid fd. | 394 // anymore, so just continue with an invalid fd. |
| 301 NaClLog(4, | 395 NaClLog(4, |
| 302 "OpenManifestEntry_MainThreadContinuation: " | 396 "OpenManifestEntry_MainThreadContinuation: " |
| 303 "GetReadonlyPnaclFd failed\n"); | 397 "GetReadonlyPnaclFd failed\n"); |
| 304 } | 398 } |
| 305 nacl::MutexLocker take(&mu_); | 399 { |
| 306 *p->op_complete_ptr = true; // done! | 400 nacl::MutexLocker take(&mu_); |
| 307 // TODO(ncbray): enable the fast loading and validation paths for this | 401 *p->op_complete_ptr = true; // done! |
| 308 // type of file. | 402 // TODO(ncbray): enable the fast loading and validation paths for this |
| 309 p->file_info->desc = fd; | 403 // type of file. |
| 310 NaClXCondVarBroadcast(&cv_); | 404 p->file_info->desc = fd; |
| 405 NaClXCondVarBroadcast(&cv_); |
| 406 } |
| 311 NaClLog(4, | 407 NaClLog(4, |
| 312 "OpenManifestEntry_MainThreadContinuation: GetPnaclFd okay\n"); | 408 "OpenManifestEntry_MainThreadContinuation: GetPnaclFd okay\n"); |
| 409 p->MaybeRunCallback(PP_OK); |
| 313 return; | 410 return; |
| 314 } | 411 } |
| 315 | 412 |
| 316 // Hereafter, normal files. | 413 // Hereafter, normal files. |
| 317 | 414 |
| 318 // Because p is owned by the callback of this invocation, so it is necessary | 415 // Because p is owned by the callback of this invocation, so it is necessary |
| 319 // to create another instance. | 416 // to create another instance. |
| 320 OpenManifestEntryResource* open_cont = new OpenManifestEntryResource(*p); | 417 OpenManifestEntryResource* open_cont = new OpenManifestEntryResource(*p); |
| 321 open_cont->url = mapped_url; | 418 open_cont->url = mapped_url; |
| 419 // Callback is now delegated from p to open_cont. So, here we manually clear |
| 420 // complete callback. |
| 421 p->callback = NULL; |
| 322 pp::CompletionCallback stream_cc = WeakRefNewCallback( | 422 pp::CompletionCallback stream_cc = WeakRefNewCallback( |
| 323 anchor_, | 423 anchor_, |
| 324 this, | 424 this, |
| 325 &PluginReverseInterface::StreamAsFile_MainThreadContinuation, | 425 &PluginReverseInterface::StreamAsFile_MainThreadContinuation, |
| 326 open_cont); | 426 open_cont); |
| 327 | 427 |
| 328 if (!plugin_->StreamAsFile(mapped_url, stream_cc)) { | 428 if (!plugin_->StreamAsFile(mapped_url, stream_cc)) { |
| 329 NaClLog(4, | 429 NaClLog(4, |
| 330 "OpenManifestEntry_MainThreadContinuation: " | 430 "OpenManifestEntry_MainThreadContinuation: " |
| 331 "StreamAsFile failed\n"); | 431 "StreamAsFile failed\n"); |
| 332 // Here, StreamAsFile is failed and stream_cc is not called. | 432 // Here, StreamAsFile is failed and stream_cc is not called. |
| 333 // However, open_cont will be released only by the invocation. | 433 // However, open_cont will be released only by the invocation. |
| 334 // So, we manually call it here with error. | 434 // So, we manually call it here with error. |
| 335 stream_cc.Run(PP_ERROR_FAILED); | 435 stream_cc.Run(PP_ERROR_FAILED); |
| 336 return; | 436 return; |
| 337 } | 437 } |
| 338 | 438 |
| 339 NaClLog(4, "OpenManifestEntry_MainThreadContinuation: StreamAsFile okay\n"); | 439 NaClLog(4, "OpenManifestEntry_MainThreadContinuation: StreamAsFile okay\n"); |
| 340 // p is deleted automatically | 440 // p is deleted automatically |
| 341 } | 441 } |
| 342 | 442 |
| 343 void PluginReverseInterface::StreamAsFile_MainThreadContinuation( | 443 void PluginReverseInterface::StreamAsFile_MainThreadContinuation( |
| 344 OpenManifestEntryResource* p, | 444 OpenManifestEntryResource* p, |
| 345 int32_t result) { | 445 int32_t result) { |
| 346 NaClLog(4, | 446 NaClLog(4, |
| 347 "Entered StreamAsFile_MainThreadContinuation\n"); | 447 "Entered StreamAsFile_MainThreadContinuation\n"); |
| 348 | 448 |
| 349 nacl::MutexLocker take(&mu_); | 449 { |
| 350 if (result == PP_OK) { | 450 nacl::MutexLocker take(&mu_); |
| 351 NaClLog(4, "StreamAsFile_MainThreadContinuation: GetFileInfo(%s)\n", | 451 if (result == PP_OK) { |
| 352 p->url.c_str()); | 452 NaClLog(4, "StreamAsFile_MainThreadContinuation: GetFileInfo(%s)\n", |
| 353 *p->file_info = plugin_->GetFileInfo(p->url); | 453 p->url.c_str()); |
| 454 *p->file_info = plugin_->GetFileInfo(p->url); |
| 354 | 455 |
| 355 NaClLog(4, | 456 NaClLog(4, |
| 356 "StreamAsFile_MainThreadContinuation: PP_OK, desc %d\n", | 457 "StreamAsFile_MainThreadContinuation: PP_OK, desc %d\n", |
| 357 p->file_info->desc); | 458 p->file_info->desc); |
| 358 } else { | 459 } else { |
| 359 NaClLog(4, | 460 NaClLog( |
| 360 "StreamAsFile_MainThreadContinuation: !PP_OK, setting desc -1\n"); | 461 4, |
| 361 p->file_info->desc = -1; | 462 "StreamAsFile_MainThreadContinuation: !PP_OK, setting desc -1\n"); |
| 463 p->file_info->desc = -1; |
| 464 } |
| 465 *p->op_complete_ptr = true; |
| 466 NaClXCondVarBroadcast(&cv_); |
| 362 } | 467 } |
| 363 *p->op_complete_ptr = true; | 468 p->MaybeRunCallback(PP_OK); |
| 364 NaClXCondVarBroadcast(&cv_); | |
| 365 } | 469 } |
| 366 | 470 |
| 367 bool PluginReverseInterface::CloseManifestEntry(int32_t desc) { | 471 bool PluginReverseInterface::CloseManifestEntry(int32_t desc) { |
| 368 bool op_complete = false; | 472 bool op_complete = false; |
| 369 bool op_result; | 473 bool op_result; |
| 370 CloseManifestEntryResource* to_close = | 474 CloseManifestEntryResource* to_close = |
| 371 new CloseManifestEntryResource(desc, &op_complete, &op_result); | 475 new CloseManifestEntryResource(desc, &op_complete, &op_result); |
| 372 | 476 |
| 373 plugin::WeakRefCallOnMainThread( | 477 plugin::WeakRefCallOnMainThread( |
| 374 anchor_, | 478 anchor_, |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 | 894 |
| 791 nacl::string ServiceRuntime::GetCrashLogOutput() { | 895 nacl::string ServiceRuntime::GetCrashLogOutput() { |
| 792 if (NULL != subprocess_.get()) { | 896 if (NULL != subprocess_.get()) { |
| 793 return subprocess_->GetCrashLogOutput(); | 897 return subprocess_->GetCrashLogOutput(); |
| 794 } else { | 898 } else { |
| 795 return std::string(); | 899 return std::string(); |
| 796 } | 900 } |
| 797 } | 901 } |
| 798 | 902 |
| 799 } // namespace plugin | 903 } // namespace plugin |
| OLD | NEW |