OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <objidl.h> | 9 #include <objidl.h> |
10 #include <mlang.h> | 10 #include <mlang.h> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 bool LaunchNaClProcess(const char* url, | 46 bool LaunchNaClProcess(const char* url, |
47 int imc_fd, | 47 int imc_fd, |
48 nacl::Handle* imc_handle, | 48 nacl::Handle* imc_handle, |
49 nacl::Handle* nacl_process_handle, | 49 nacl::Handle* nacl_process_handle, |
50 int* nacl_process_id) { | 50 int* nacl_process_id) { |
51 // TODO(gregoryd): nacl::FileDescriptor will be soon merged with | 51 // TODO(gregoryd): nacl::FileDescriptor will be soon merged with |
52 // base::FileDescriptor | 52 // base::FileDescriptor |
53 nacl::FileDescriptor imc_descriptor; | 53 std::vector<nacl::FileDescriptor> sockets; |
54 base::ProcessHandle nacl_process; | 54 base::ProcessHandle nacl_process; |
55 if (!RenderThread::current()->Send( | 55 if (!RenderThread::current()->Send( |
56 new ViewHostMsg_LaunchNaCl(ASCIIToWide(url), | 56 new ViewHostMsg_LaunchNaCl( |
57 imc_fd, | 57 ASCIIToWide(url), |
58 &imc_descriptor, | 58 /* socket_count= */ 1, |
| 59 &sockets, |
59 &nacl_process, | 60 &nacl_process, |
60 reinterpret_cast<base::ProcessId*>(nacl_process_id)))) { | 61 reinterpret_cast<base::ProcessId*>(nacl_process_id)))) { |
61 return false; | 62 return false; |
62 } | 63 } |
63 *imc_handle = nacl::ToNativeHandle(imc_descriptor); | 64 CHECK(static_cast<int>(sockets.size()) == 1); |
| 65 *imc_handle = nacl::ToNativeHandle(sockets[0]); |
64 *nacl_process_handle = nacl_process; | 66 *nacl_process_handle = nacl_process; |
65 return true; | 67 return true; |
66 } | 68 } |
| 69 |
| 70 bool LaunchNaClProcessMultiFD(const char* alleged_url, |
| 71 int socket_count, |
| 72 nacl::Handle* imc_handles, |
| 73 nacl::Handle* nacl_process_handle, |
| 74 int* nacl_process_id) { |
| 75 // TODO(gregoryd): nacl::FileDescriptor will be soon merged with |
| 76 // base::FileDescriptor |
| 77 std::vector<nacl::FileDescriptor> sockets; |
| 78 base::ProcessHandle nacl_process; |
| 79 if (!RenderThread::current()->Send( |
| 80 new ViewHostMsg_LaunchNaCl( |
| 81 ASCIIToWide(alleged_url), |
| 82 socket_count, |
| 83 &sockets, |
| 84 &nacl_process, |
| 85 reinterpret_cast<base::ProcessId*>(nacl_process_id)))) { |
| 86 return false; |
| 87 } |
| 88 CHECK(static_cast<int>(sockets.size()) == socket_count); |
| 89 for (int i = 0; i < socket_count; i++) { |
| 90 imc_handles[i] = nacl::ToNativeHandle(sockets[i]); |
| 91 } |
| 92 *nacl_process_handle = nacl_process; |
| 93 return true; |
| 94 } |
67 | 95 |
68 } // namespace | 96 } // namespace |
69 | 97 |
70 //----------------------------------------------------------------------------- | 98 //----------------------------------------------------------------------------- |
71 | 99 |
72 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
73 | 101 |
74 static iat_patch::IATPatchFunction g_iat_patch_createdca; | 102 static iat_patch::IATPatchFunction g_iat_patch_createdca; |
75 HDC WINAPI CreateDCAPatch(LPCSTR driver_name, | 103 HDC WINAPI CreateDCAPatch(LPCSTR driver_name, |
76 LPCSTR device_name, | 104 LPCSTR device_name, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 179 |
152 if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { | 180 if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { |
153 StatisticsRecorder::set_dump_on_exit(true); | 181 StatisticsRecorder::set_dump_on_exit(true); |
154 } | 182 } |
155 | 183 |
156 #ifndef DISABLE_NACL | 184 #ifndef DISABLE_NACL |
157 if (command_line.HasSwitch(switches::kInternalNaCl)) { | 185 if (command_line.HasSwitch(switches::kInternalNaCl)) { |
158 std::map<std::string, uintptr_t> funcs; | 186 std::map<std::string, uintptr_t> funcs; |
159 funcs["launch_nacl_process"] = | 187 funcs["launch_nacl_process"] = |
160 reinterpret_cast<uintptr_t>(LaunchNaClProcess); | 188 reinterpret_cast<uintptr_t>(LaunchNaClProcess); |
| 189 funcs["launch_nacl_process_multi_fd"] = |
| 190 reinterpret_cast<uintptr_t>(LaunchNaClProcessMultiFD); |
161 RegisterInternalNaClPlugin(funcs); | 191 RegisterInternalNaClPlugin(funcs); |
162 } | 192 } |
163 #endif | 193 #endif |
164 | 194 |
165 if (!command_line.HasSwitch(switches::kDisableByteRangeSupport)) { | 195 if (!command_line.HasSwitch(switches::kDisableByteRangeSupport)) { |
166 webkit_glue::SetMediaCacheEnabled(true); | 196 webkit_glue::SetMediaCacheEnabled(true); |
167 } | 197 } |
168 | 198 |
169 #if defined(OS_MACOSX) | 199 #if defined(OS_MACOSX) |
170 FilePath bundle_path = mac_util::MainAppBundlePath(); | 200 FilePath bundle_path = mac_util::MainAppBundlePath(); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 } | 387 } |
358 | 388 |
359 void RenderProcessImpl::ClearTransportDIBCache() { | 389 void RenderProcessImpl::ClearTransportDIBCache() { |
360 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { | 390 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { |
361 if (shared_mem_cache_[i]) { | 391 if (shared_mem_cache_[i]) { |
362 FreeTransportDIB(shared_mem_cache_[i]); | 392 FreeTransportDIB(shared_mem_cache_[i]); |
363 shared_mem_cache_[i] = NULL; | 393 shared_mem_cache_[i] = NULL; |
364 } | 394 } |
365 } | 395 } |
366 } | 396 } |
OLD | NEW |