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/pnacl_translate_thread.h" | 5 #include "ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" | 9 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
10 #include "ppapi/native_client/src/trusted/plugin/plugin.h" | 10 #include "ppapi/native_client/src/trusted/plugin/plugin.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 bytes->resize(buffer_size); | 108 bytes->resize(buffer_size); |
109 } | 109 } |
110 | 110 |
111 NaClSubprocess* PnaclTranslateThread::StartSubprocess( | 111 NaClSubprocess* PnaclTranslateThread::StartSubprocess( |
112 const nacl::string& url_for_nexe, | 112 const nacl::string& url_for_nexe, |
113 const Manifest* manifest, | 113 const Manifest* manifest, |
114 ErrorInfo* error_info) { | 114 ErrorInfo* error_info) { |
115 PLUGIN_PRINTF(("PnaclTranslateThread::StartSubprocess (url_for_nexe=%s)\n", | 115 PLUGIN_PRINTF(("PnaclTranslateThread::StartSubprocess (url_for_nexe=%s)\n", |
116 url_for_nexe.c_str())); | 116 url_for_nexe.c_str())); |
117 nacl::DescWrapper* wrapper = resources_->WrapperForUrl(url_for_nexe); | 117 nacl::DescWrapper* wrapper = resources_->WrapperForUrl(url_for_nexe); |
| 118 // Supply a URL for the translator components, different from the app URL, |
| 119 // so that NaCl GDB can filter-out the translator processes (and not debug |
| 120 // the translator itself). Must have a full URL with schema, otherwise the |
| 121 // string gets silently dropped by GURL. |
| 122 nacl::string full_url = resources_->GetFullUrl(url_for_nexe); |
118 nacl::scoped_ptr<NaClSubprocess> subprocess( | 123 nacl::scoped_ptr<NaClSubprocess> subprocess( |
119 plugin_->LoadHelperNaClModule(wrapper, manifest, error_info)); | 124 plugin_->LoadHelperNaClModule(full_url, wrapper, manifest, error_info)); |
120 if (subprocess.get() == NULL) { | 125 if (subprocess.get() == NULL) { |
121 PLUGIN_PRINTF(( | 126 PLUGIN_PRINTF(( |
122 "PnaclTranslateThread::StartSubprocess: subprocess creation failed\n")); | 127 "PnaclTranslateThread::StartSubprocess: subprocess creation failed\n")); |
123 return NULL; | 128 return NULL; |
124 } | 129 } |
125 return subprocess.release(); | 130 return subprocess.release(); |
126 } | 131 } |
127 | 132 |
128 void WINAPI PnaclTranslateThread::DoTranslateThread(void* arg) { | 133 void WINAPI PnaclTranslateThread::DoTranslateThread(void* arg) { |
129 PnaclTranslateThread* translator = | 134 PnaclTranslateThread* translator = |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 AbortSubprocesses(); | 458 AbortSubprocesses(); |
454 if (translate_thread_ != NULL) | 459 if (translate_thread_ != NULL) |
455 NaClThreadJoin(translate_thread_.get()); | 460 NaClThreadJoin(translate_thread_.get()); |
456 PLUGIN_PRINTF(("~PnaclTranslateThread joined\n")); | 461 PLUGIN_PRINTF(("~PnaclTranslateThread joined\n")); |
457 NaClCondVarDtor(&buffer_cond_); | 462 NaClCondVarDtor(&buffer_cond_); |
458 NaClMutexDtor(&cond_mu_); | 463 NaClMutexDtor(&cond_mu_); |
459 NaClMutexDtor(&subprocess_mu_); | 464 NaClMutexDtor(&subprocess_mu_); |
460 } | 465 } |
461 | 466 |
462 } // namespace plugin | 467 } // namespace plugin |
OLD | NEW |