| OLD | NEW |
| 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> |
| 11 | 11 |
| 12 #include "native_client/src/include/nacl_base.h" | 12 #include "native_client/src/include/nacl_base.h" |
| 13 #include "native_client/src/include/nacl_macros.h" | 13 #include "native_client/src/include/nacl_macros.h" |
| 14 #include "native_client/src/include/nacl_scoped_ptr.h" | 14 #include "native_client/src/include/nacl_scoped_ptr.h" |
| 15 #include "native_client/src/include/nacl_string.h" | 15 #include "native_client/src/include/nacl_string.h" |
| 16 #include "native_client/src/include/portability.h" | 16 #include "native_client/src/include/portability.h" |
| 17 #include "native_client/src/include/portability_io.h" | 17 #include "native_client/src/include/portability_io.h" |
| 18 #include "native_client/src/include/portability_string.h" | 18 #include "native_client/src/include/portability_string.h" |
| 19 #include "native_client/src/public/nacl_file_info.h" | 19 #include "native_client/src/public/nacl_file_info.h" |
| 20 #include "native_client/src/shared/platform/nacl_check.h" | 20 #include "native_client/src/shared/platform/nacl_check.h" |
| 21 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 21 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
| 22 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" | 22 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" |
| 23 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" | 23 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" |
| 24 | 24 |
| 25 #include "ppapi/c/pp_errors.h" | 25 #include "ppapi/c/pp_errors.h" |
| 26 #include "ppapi/c/private/ppb_nacl_private.h" | 26 #include "ppapi/c/private/ppb_nacl_private.h" |
| 27 #include "ppapi/cpp/dev/url_util_dev.h" | |
| 28 #include "ppapi/cpp/module.h" | 27 #include "ppapi/cpp/module.h" |
| 29 | 28 |
| 30 #include "ppapi/native_client/src/trusted/plugin/nacl_subprocess.h" | 29 #include "ppapi/native_client/src/trusted/plugin/nacl_subprocess.h" |
| 31 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" | 30 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" |
| 32 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" | 31 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" |
| 33 #include "ppapi/native_client/src/trusted/plugin/utility.h" | 32 #include "ppapi/native_client/src/trusted/plugin/utility.h" |
| 34 | 33 |
| 35 namespace plugin { | 34 namespace plugin { |
| 36 | 35 |
| 37 namespace { | 36 namespace { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 callback_factory_.Initialize(this); | 268 callback_factory_.Initialize(this); |
| 270 nacl_interface_ = GetNaClInterface(); | 269 nacl_interface_ = GetNaClInterface(); |
| 271 CHECK(nacl_interface_ != NULL); | 270 CHECK(nacl_interface_ != NULL); |
| 272 | 271 |
| 273 // Notify PPB_NaCl_Private that the instance is created before altering any | 272 // Notify PPB_NaCl_Private that the instance is created before altering any |
| 274 // state that it tracks. | 273 // state that it tracks. |
| 275 nacl_interface_->InstanceCreated(pp_instance); | 274 nacl_interface_->InstanceCreated(pp_instance); |
| 276 nexe_file_info_ = kInvalidNaClFileInfo; | 275 nexe_file_info_ = kInvalidNaClFileInfo; |
| 277 } | 276 } |
| 278 | 277 |
| 279 | |
| 280 Plugin::~Plugin() { | 278 Plugin::~Plugin() { |
| 281 int64_t shutdown_start = NaClGetTimeOfDayMicroseconds(); | 279 int64_t shutdown_start = NaClGetTimeOfDayMicroseconds(); |
| 282 | 280 |
| 283 // Destroy the coordinator while the rest of the data is still there | 281 // Destroy the coordinator while the rest of the data is still there |
| 284 pnacl_coordinator_.reset(NULL); | 282 pnacl_coordinator_.reset(NULL); |
| 285 | 283 |
| 286 nacl_interface_->InstanceDestroyed(pp_instance()); | 284 nacl_interface_->InstanceDestroyed(pp_instance()); |
| 287 | 285 |
| 288 // ShutDownSubprocesses shuts down the main subprocess, which shuts | 286 // ShutDownSubprocesses shuts down the main subprocess, which shuts |
| 289 // down the main ServiceRuntime object, which kills the subprocess. | 287 // down the main ServiceRuntime object, which kills the subprocess. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 } | 424 } |
| 427 } | 425 } |
| 428 } | 426 } |
| 429 | 427 |
| 430 void Plugin::ReportLoadError(const ErrorInfo& error_info) { | 428 void Plugin::ReportLoadError(const ErrorInfo& error_info) { |
| 431 nacl_interface_->ReportLoadError(pp_instance(), | 429 nacl_interface_->ReportLoadError(pp_instance(), |
| 432 error_info.error_code(), | 430 error_info.error_code(), |
| 433 error_info.message().c_str()); | 431 error_info.message().c_str()); |
| 434 } | 432 } |
| 435 | 433 |
| 436 bool Plugin::DocumentCanRequest(const std::string& url) { | |
| 437 CHECK(pp::Module::Get()->core()->IsMainThread()); | |
| 438 CHECK(pp::URLUtil_Dev::Get() != NULL); | |
| 439 return pp::URLUtil_Dev::Get()->DocumentCanRequest(this, pp::Var(url)); | |
| 440 } | |
| 441 | |
| 442 } // namespace plugin | 434 } // namespace plugin |
| OLD | NEW |