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 "chrome/browser/nacl_host/nacl_process_host.h" | 5 #include "chrome/browser/nacl_host/nacl_process_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 | 402 |
403 void NaClProcessHost::DebugContext::StopThread() { | 403 void NaClProcessHost::DebugContext::StopThread() { |
404 thread_->Stop(); | 404 thread_->Stop(); |
405 thread_.reset(); | 405 thread_.reset(); |
406 } | 406 } |
407 #endif | 407 #endif |
408 | 408 |
409 struct NaClProcessHost::NaClInternal { | 409 struct NaClProcessHost::NaClInternal { |
410 std::vector<nacl::Handle> sockets_for_renderer; | 410 std::vector<nacl::Handle> sockets_for_renderer; |
411 std::vector<nacl::Handle> sockets_for_sel_ldr; | 411 std::vector<nacl::Handle> sockets_for_sel_ldr; |
412 std::string channel_name; | |
Mark Seaborn
2012/04/25 00:40:39
This doesn't need to go in NaClInternal. You can
bbudge
2012/04/25 00:50:04
Yes, I'll remove it from this struct.
| |
412 }; | 413 }; |
413 | 414 |
414 // ----------------------------------------------------------------------------- | 415 // ----------------------------------------------------------------------------- |
415 | 416 |
416 NaClProcessHost::NaClProcessHost(const GURL& manifest_url) | 417 NaClProcessHost::NaClProcessHost(const GURL& manifest_url) |
417 : manifest_url_(manifest_url), | 418 : manifest_url_(manifest_url), |
418 #if defined(OS_WIN) | 419 #if defined(OS_WIN) |
419 process_launched_by_broker_(false), | 420 process_launched_by_broker_(false), |
420 #elif defined(OS_LINUX) | 421 #elif defined(OS_LINUX) |
421 wait_for_nacl_gdb_(false), | 422 wait_for_nacl_gdb_(false), |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
509 } | 510 } |
510 | 511 |
511 // Start getting the IRT open asynchronously while we launch the NaCl process. | 512 // Start getting the IRT open asynchronously while we launch the NaCl process. |
512 // We'll make sure this actually finished in StartWithLaunchedProcess, below. | 513 // We'll make sure this actually finished in StartWithLaunchedProcess, below. |
513 if (!NaClBrowser::GetInstance()->EnsureIrtAvailable()) { | 514 if (!NaClBrowser::GetInstance()->EnsureIrtAvailable()) { |
514 DLOG(ERROR) << "Cannot launch NaCl process after IRT file open failed"; | 515 DLOG(ERROR) << "Cannot launch NaCl process after IRT file open failed"; |
515 delete this; | 516 delete this; |
516 return; | 517 return; |
517 } | 518 } |
518 | 519 |
520 internal_->channel_name = | |
521 IPC::Channel::GenerateVerifiedChannelID(std::string()); | |
bbudge
2012/04/25 00:50:04
This bit of code doesn't seem to work, in that the
| |
522 | |
519 // Rather than creating a socket pair in the renderer, and passing | 523 // Rather than creating a socket pair in the renderer, and passing |
520 // one side through the browser to sel_ldr, socket pairs are created | 524 // one side through the browser to sel_ldr, socket pairs are created |
521 // in the browser and then passed to the renderer and sel_ldr. | 525 // in the browser and then passed to the renderer and sel_ldr. |
522 // | 526 // |
523 // This is mainly for the benefit of Windows, where sockets cannot | 527 // This is mainly for the benefit of Windows, where sockets cannot |
524 // be passed in messages, but are copied via DuplicateHandle(). | 528 // be passed in messages, but are copied via DuplicateHandle(). |
525 // This means the sandboxed renderer cannot send handles to the | 529 // This means the sandboxed renderer cannot send handles to the |
526 // browser process. | 530 // browser process. |
527 | 531 |
528 for (int i = 0; i < socket_count; i++) { | 532 for (int i = 0; i < socket_count; i++) { |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
952 chrome_render_message_filter_ = NULL; | 956 chrome_render_message_filter_ = NULL; |
953 reply_msg_ = NULL; | 957 reply_msg_ = NULL; |
954 internal_->sockets_for_renderer.clear(); | 958 internal_->sockets_for_renderer.clear(); |
955 return true; | 959 return true; |
956 } | 960 } |
957 | 961 |
958 bool NaClProcessHost::StartNaClExecution() { | 962 bool NaClProcessHost::StartNaClExecution() { |
959 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); | 963 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); |
960 | 964 |
961 nacl::NaClStartParams params; | 965 nacl::NaClStartParams params; |
966 params.channel_name = internal_->channel_name; | |
962 params.validation_cache_key = nacl_browser->GetValidatorCacheKey(); | 967 params.validation_cache_key = nacl_browser->GetValidatorCacheKey(); |
963 params.version = chrome::VersionInfo().CreateVersionString(); | 968 params.version = chrome::VersionInfo().CreateVersionString(); |
964 params.enable_exception_handling = enable_exception_handling_; | 969 params.enable_exception_handling = enable_exception_handling_; |
965 | 970 |
966 base::PlatformFile irt_file = nacl_browser->IrtFile(); | 971 base::PlatformFile irt_file = nacl_browser->IrtFile(); |
967 CHECK_NE(irt_file, base::kInvalidPlatformFileValue); | 972 CHECK_NE(irt_file, base::kInvalidPlatformFileValue); |
968 | 973 |
969 const ChildProcessData& data = process_->GetData(); | 974 const ChildProcessData& data = process_->GetData(); |
970 for (size_t i = 0; i < internal_->sockets_for_sel_ldr.size(); i++) { | 975 for (size_t i = 0; i < internal_->sockets_for_sel_ldr.size(); i++) { |
971 if (!ShareHandleToSelLdr(data.handle, | 976 if (!ShareHandleToSelLdr(data.handle, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1045 } | 1050 } |
1046 | 1051 |
1047 void NaClProcessHost::OnQueryKnownToValidate(const std::string& signature, | 1052 void NaClProcessHost::OnQueryKnownToValidate(const std::string& signature, |
1048 bool* result) { | 1053 bool* result) { |
1049 *result = NaClBrowser::GetInstance()->QueryKnownToValidate(signature); | 1054 *result = NaClBrowser::GetInstance()->QueryKnownToValidate(signature); |
1050 } | 1055 } |
1051 | 1056 |
1052 void NaClProcessHost::OnSetKnownToValidate(const std::string& signature) { | 1057 void NaClProcessHost::OnSetKnownToValidate(const std::string& signature) { |
1053 NaClBrowser::GetInstance()->SetKnownToValidate(signature); | 1058 NaClBrowser::GetInstance()->SetKnownToValidate(signature); |
1054 } | 1059 } |
OLD | NEW |