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

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

Issue 8786005: Move command line processing out of coordinator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifdef _MSC_VER 5 #ifdef _MSC_VER
6 // Do not warn about use of std::copy with raw pointers. 6 // Do not warn about use of std::copy with raw pointers.
7 #pragma warning(disable : 4996) 7 #pragma warning(disable : 4996)
8 #endif 8 #endif
9 9
10 #include "native_client/src/trusted/plugin/plugin.h" 10 #include "native_client/src/trusted/plugin/plugin.h"
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 : pp::InstancePrivate(pp_instance), 981 : pp::InstancePrivate(pp_instance),
982 browser_interface_(NULL), 982 browser_interface_(NULL),
983 scriptable_handle_(NULL), 983 scriptable_handle_(NULL),
984 argc_(-1), 984 argc_(-1),
985 argn_(NULL), 985 argn_(NULL),
986 argv_(NULL), 986 argv_(NULL),
987 main_subprocess_(kMainSubprocessId, NULL, NULL), 987 main_subprocess_(kMainSubprocessId, NULL, NULL),
988 nacl_ready_state_(UNSENT), 988 nacl_ready_state_(UNSENT),
989 nexe_error_reported_(false), 989 nexe_error_reported_(false),
990 wrapper_factory_(NULL), 990 wrapper_factory_(NULL),
991 pnacl_(NULL),
991 last_error_string_(""), 992 last_error_string_(""),
992 ppapi_proxy_(NULL), 993 ppapi_proxy_(NULL),
993 enable_dev_interfaces_(false), 994 enable_dev_interfaces_(false),
994 replayDidChangeView(false), 995 replayDidChangeView(false),
995 replayHandleDocumentLoad(false), 996 replayHandleDocumentLoad(false),
996 init_time_(0), 997 init_time_(0),
997 ready_time_(0), 998 ready_time_(0),
998 nexe_size_(0), 999 nexe_size_(0),
999 time_of_last_progress_event_(0) { 1000 time_of_last_progress_event_(0) {
1000 PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%" 1001 PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%"
1001 NACL_PRId32")\n", static_cast<void*>(this), pp_instance)); 1002 NACL_PRId32")\n", static_cast<void*>(this), pp_instance));
1002 NaClSrpcModuleInit(); 1003 NaClSrpcModuleInit();
1004 callback_factory_.Initialize(this);
1003 nexe_downloader_.Initialize(this); 1005 nexe_downloader_.Initialize(this);
1004 pnacl_.Initialize(this);
1005 callback_factory_.Initialize(this);
1006 } 1006 }
1007 1007
1008 1008
1009 Plugin::~Plugin() { 1009 Plugin::~Plugin() {
1010 int64_t shutdown_start = NaClGetTimeOfDayMicroseconds(); 1010 int64_t shutdown_start = NaClGetTimeOfDayMicroseconds();
1011 1011
1012 PLUGIN_PRINTF(("Plugin::~Plugin (this=%p, scriptable_handle=%p)\n", 1012 PLUGIN_PRINTF(("Plugin::~Plugin (this=%p, scriptable_handle=%p)\n",
1013 static_cast<void*>(this), 1013 static_cast<void*>(this),
1014 static_cast<void*>(scriptable_handle()))); 1014 static_cast<void*>(scriptable_handle())));
1015 1015
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate (pp_error=%"NACL_PRId32")\n", 1298 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate (pp_error=%"NACL_PRId32")\n",
1299 pp_error)); 1299 pp_error));
1300 if (pp_error != PP_OK) { 1300 if (pp_error != PP_OK) {
1301 // Error should have been reported by pnacl. Just return. 1301 // Error should have been reported by pnacl. Just return.
1302 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate error in Pnacl\n")); 1302 PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate error in Pnacl\n"));
1303 return; 1303 return;
1304 } 1304 }
1305 // Inform JavaScript that we successfully translated the bitcode to a nexe. 1305 // Inform JavaScript that we successfully translated the bitcode to a nexe.
1306 EnqueueProgressEvent(kProgressEventProgress); 1306 EnqueueProgressEvent(kProgressEventProgress);
1307 nacl::scoped_ptr<nacl::DescWrapper> 1307 nacl::scoped_ptr<nacl::DescWrapper>
1308 wrapper(pnacl_.ReleaseTranslatedFD()); 1308 wrapper(pnacl_->ReleaseTranslatedFD());
1309 ErrorInfo error_info; 1309 ErrorInfo error_info;
1310 bool was_successful = LoadNaClModule( 1310 bool was_successful = LoadNaClModule(
1311 wrapper.get(), &error_info, 1311 wrapper.get(), &error_info,
1312 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslateContinuation), 1312 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslateContinuation),
1313 pp::BlockUntilComplete()); 1313 pp::BlockUntilComplete());
1314 1314
1315 if (!was_successful) { 1315 if (!was_successful) {
1316 ReportLoadError(error_info); 1316 ReportLoadError(error_info);
1317 } 1317 }
1318 } 1318 }
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 return; 1613 return;
1614 } 1614 }
1615 1615
1616 if (SelectProgramURLFromManifest(&program_url, &error_info, &is_portable)) { 1616 if (SelectProgramURLFromManifest(&program_url, &error_info, &is_portable)) {
1617 set_nacl_ready_state(LOADING); 1617 set_nacl_ready_state(LOADING);
1618 // Inform JavaScript that we found a nexe URL to load. 1618 // Inform JavaScript that we found a nexe URL to load.
1619 EnqueueProgressEvent(kProgressEventProgress); 1619 EnqueueProgressEvent(kProgressEventProgress);
1620 if (is_portable) { 1620 if (is_portable) {
1621 pp::CompletionCallback translate_callback = 1621 pp::CompletionCallback translate_callback =
1622 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslate); 1622 callback_factory_.NewCallback(&Plugin::BitcodeDidTranslate);
1623 // Will always call the callback on success or failure. 1623 // Will always call the callback on success or failure.
robertm 2011/12/13 17:06:39 it might be useful for debugging to issue Progres
sehr (please use chromium) 2011/12/13 20:05:04 There are tests that rely on how many progress eve
1624 pnacl_.BitcodeToNative(program_url, translate_callback); 1624 pnacl_ = PnaclCoordinator::BitcodeToNative(this,
robertm 2011/12/13 17:06:39 is this overwritten every time? maybe use a scoped
sehr (please use chromium) 2011/12/13 20:05:04 Used a scoped_ptr. The ugly thing is I think NaCl
1625 program_url,
1626 translate_callback);
1625 return; 1627 return;
1626 } else { 1628 } else {
1627 pp::CompletionCallback open_callback = 1629 pp::CompletionCallback open_callback =
1628 callback_factory_.NewRequiredCallback(&Plugin::NexeFileDidOpen); 1630 callback_factory_.NewRequiredCallback(&Plugin::NexeFileDidOpen);
1629 // Will always call the callback on success or failure. 1631 // Will always call the callback on success or failure.
1630 CHECK( 1632 CHECK(
1631 nexe_downloader_.Open(program_url, 1633 nexe_downloader_.Open(program_url,
1632 DOWNLOAD_TO_FILE, 1634 DOWNLOAD_TO_FILE,
1633 open_callback, 1635 open_callback,
1634 &UpdateDownloadProgress)); 1636 &UpdateDownloadProgress));
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 std::string scheme = canonicalized.AsString().substr(comps.scheme.begin, 2032 std::string scheme = canonicalized.AsString().substr(comps.scheme.begin,
2031 comps.scheme.len); 2033 comps.scheme.len);
2032 if (scheme == kChromeExtensionUriScheme) 2034 if (scheme == kChromeExtensionUriScheme)
2033 return SCHEME_CHROME_EXTENSION; 2035 return SCHEME_CHROME_EXTENSION;
2034 if (scheme == kDataUriScheme) 2036 if (scheme == kDataUriScheme)
2035 return SCHEME_DATA; 2037 return SCHEME_DATA;
2036 return SCHEME_OTHER; 2038 return SCHEME_OTHER;
2037 } 2039 }
2038 2040
2039 } // namespace plugin 2041 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698