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

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

Issue 292743011: Pepper: Simplify Pnacl manifest id logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 7 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 // 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/pnacl_coordinator.h" 5 #include "ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "native_client/src/include/checked_cast.h" 10 #include "native_client/src/include/checked_cast.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 Plugin* plugin, 122 Plugin* plugin,
123 const nacl::string& pexe_url, 123 const nacl::string& pexe_url,
124 const PP_PNaClOptions& pnacl_options, 124 const PP_PNaClOptions& pnacl_options,
125 const pp::CompletionCallback& translate_notify_callback) { 125 const pp::CompletionCallback& translate_notify_callback) {
126 PLUGIN_PRINTF(("PnaclCoordinator::BitcodeToNative (plugin=%p, pexe=%s)\n", 126 PLUGIN_PRINTF(("PnaclCoordinator::BitcodeToNative (plugin=%p, pexe=%s)\n",
127 static_cast<void*>(plugin), pexe_url.c_str())); 127 static_cast<void*>(plugin), pexe_url.c_str()));
128 PnaclCoordinator* coordinator = 128 PnaclCoordinator* coordinator =
129 new PnaclCoordinator(plugin, pexe_url, 129 new PnaclCoordinator(plugin, pexe_url,
130 pnacl_options, 130 pnacl_options,
131 translate_notify_callback); 131 translate_notify_callback);
132 PLUGIN_PRINTF(("PnaclCoordinator::BitcodeToNative (manifest_id=%d)\n",
133 coordinator->manifest_id_));
134 132
135 coordinator->pnacl_init_time_ = NaClGetTimeOfDayMicroseconds(); 133 coordinator->pnacl_init_time_ = NaClGetTimeOfDayMicroseconds();
136 int cpus = plugin->nacl_interface()->GetNumberOfProcessors(); 134 int cpus = plugin->nacl_interface()->GetNumberOfProcessors();
137 coordinator->split_module_count_ = std::min(4, std::max(1, cpus)); 135 coordinator->split_module_count_ = std::min(4, std::max(1, cpus));
138 136
139 // First start a network request for the pexe, to tickle the component 137 // First start a network request for the pexe, to tickle the component
140 // updater's On-Demand resource throttler, and to get Last-Modified/ETag 138 // updater's On-Demand resource throttler, and to get Last-Modified/ETag
141 // cache information. We can cancel the request later if there's 139 // cache information. We can cancel the request later if there's
142 // a bitcode->nexe cache hit. 140 // a bitcode->nexe cache hit.
143 coordinator->OpenBitcodeStream(); 141 coordinator->OpenBitcodeStream();
144 return coordinator; 142 return coordinator;
145 } 143 }
146 144
147 PnaclCoordinator::PnaclCoordinator( 145 PnaclCoordinator::PnaclCoordinator(
148 Plugin* plugin, 146 Plugin* plugin,
149 const nacl::string& pexe_url, 147 const nacl::string& pexe_url,
150 const PP_PNaClOptions& pnacl_options, 148 const PP_PNaClOptions& pnacl_options,
151 const pp::CompletionCallback& translate_notify_callback) 149 const pp::CompletionCallback& translate_notify_callback)
152 : translate_finish_error_(PP_OK), 150 : translate_finish_error_(PP_OK),
153 plugin_(plugin), 151 plugin_(plugin),
154 translate_notify_callback_(translate_notify_callback), 152 translate_notify_callback_(translate_notify_callback),
155 translation_finished_reported_(false), 153 translation_finished_reported_(false),
156 manifest_id_(
157 GetNaClInterface()->CreatePnaclManifest(plugin->pp_instance())),
158 pexe_url_(pexe_url), 154 pexe_url_(pexe_url),
159 pnacl_options_(pnacl_options), 155 pnacl_options_(pnacl_options),
160 architecture_attributes_(GetArchitectureAttributes(plugin)), 156 architecture_attributes_(GetArchitectureAttributes(plugin)),
161 split_module_count_(1), 157 split_module_count_(1),
162 num_object_files_opened_(0), 158 num_object_files_opened_(0),
163 is_cache_hit_(PP_FALSE), 159 is_cache_hit_(PP_FALSE),
164 error_already_reported_(false), 160 error_already_reported_(false),
165 pnacl_init_time_(0), 161 pnacl_init_time_(0),
166 pexe_size_(0), 162 pexe_size_(0),
167 pexe_bytes_compiled_(0), 163 pexe_bytes_compiled_(0),
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 void PnaclCoordinator::RunTranslate(int32_t pp_error) { 608 void PnaclCoordinator::RunTranslate(int32_t pp_error) {
613 PLUGIN_PRINTF(("PnaclCoordinator::RunTranslate (pp_error=%" 609 PLUGIN_PRINTF(("PnaclCoordinator::RunTranslate (pp_error=%"
614 NACL_PRId32 ")\n", pp_error)); 610 NACL_PRId32 ")\n", pp_error));
615 // Invoke llc followed by ld off the main thread. This allows use of 611 // Invoke llc followed by ld off the main thread. This allows use of
616 // blocking RPCs that would otherwise block the JavaScript main thread. 612 // blocking RPCs that would otherwise block the JavaScript main thread.
617 pp::CompletionCallback report_translate_finished = 613 pp::CompletionCallback report_translate_finished =
618 callback_factory_.NewCallback(&PnaclCoordinator::TranslateFinished); 614 callback_factory_.NewCallback(&PnaclCoordinator::TranslateFinished);
619 615
620 CHECK(translate_thread_ != NULL); 616 CHECK(translate_thread_ != NULL);
621 translate_thread_->RunTranslate(report_translate_finished, 617 translate_thread_->RunTranslate(report_translate_finished,
622 manifest_id_,
623 &obj_files_, 618 &obj_files_,
624 temp_nexe_file_.get(), 619 temp_nexe_file_.get(),
625 invalid_desc_wrapper_.get(), 620 invalid_desc_wrapper_.get(),
626 &error_info_, 621 &error_info_,
627 resources_.get(), 622 resources_.get(),
628 &pnacl_options_, 623 &pnacl_options_,
629 architecture_attributes_, 624 architecture_attributes_,
630 this, 625 this,
631 plugin_); 626 plugin_);
632 } 627 }
633 628
634 } // namespace plugin 629 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698