OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // member could be in use while the object itself is destroyed, | 99 // member could be in use while the object itself is destroyed, |
100 // as a result of the containing RenderProcess object being destroyed. | 100 // as a result of the containing RenderProcess object being destroyed. |
101 // This race condition causes a crash when the renderer process is shutting | 101 // This race condition causes a crash when the renderer process is shutting |
102 // down. | 102 // down. |
103 child_thread()->Stop(); | 103 child_thread()->Stop(); |
104 ClearTransportDIBCache(); | 104 ClearTransportDIBCache(); |
105 } | 105 } |
106 | 106 |
107 void RenderProcess::Init() { | 107 void RenderProcess::Init() { |
108 in_process_plugins_ = InProcessPlugins(); | 108 in_process_plugins_ = InProcessPlugins(); |
109 in_process_gears_ = false; | |
110 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) | 109 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) |
111 shared_mem_cache_[i] = NULL; | 110 shared_mem_cache_[i] = NULL; |
112 | 111 |
113 #if defined(OS_WIN) | 112 #if defined(OS_WIN) |
114 // HACK: See http://b/issue?id=1024307 for rationale. | 113 // HACK: See http://b/issue?id=1024307 for rationale. |
115 if (GetModuleHandle(L"LPK.DLL") == NULL) { | 114 if (GetModuleHandle(L"LPK.DLL") == NULL) { |
116 // Makes sure lpk.dll is loaded by gdi32 to make sure ExtTextOut() works | 115 // Makes sure lpk.dll is loaded by gdi32 to make sure ExtTextOut() works |
117 // when buffering into a EMF buffer for printing. | 116 // when buffering into a EMF buffer for printing. |
118 typedef BOOL (__stdcall *GdiInitializeLanguagePack)(int LoadedShapingDLLs); | 117 typedef BOOL (__stdcall *GdiInitializeLanguagePack)(int LoadedShapingDLLs); |
119 GdiInitializeLanguagePack gdi_init_lpk = | 118 GdiInitializeLanguagePack gdi_init_lpk = |
(...skipping 14 matching lines...) Expand all Loading... |
134 } | 133 } |
135 | 134 |
136 if (command_line.HasSwitch(switches::kEnableWatchdog)) { | 135 if (command_line.HasSwitch(switches::kEnableWatchdog)) { |
137 // TODO(JAR): Need to implement renderer IO msgloop watchdog. | 136 // TODO(JAR): Need to implement renderer IO msgloop watchdog. |
138 } | 137 } |
139 | 138 |
140 if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { | 139 if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { |
141 StatisticsRecorder::set_dump_on_exit(true); | 140 StatisticsRecorder::set_dump_on_exit(true); |
142 } | 141 } |
143 | 142 |
144 if (command_line.HasSwitch(switches::kGearsInRenderer)) { | |
145 #if defined(OS_WIN) | |
146 in_process_gears_ = true; | |
147 // Load gears.dll on startup so we can access it before the sandbox | |
148 // blocks us. | |
149 std::wstring path; | |
150 if (PathService::Get(chrome::FILE_GEARS_PLUGIN, &path)) | |
151 LoadLibrary(path.c_str()); | |
152 #else | |
153 // TODO(port) Need to handle loading gears on non-Windows platforms | |
154 NOTIMPLEMENTED(); | |
155 #endif | |
156 } | |
157 | |
158 if (command_line.HasSwitch(switches::kEnableVideo) && LoadFFmpeg()) { | 143 if (command_line.HasSwitch(switches::kEnableVideo) && LoadFFmpeg()) { |
159 webkit_glue::SetMediaPlayerAvailable(true); | 144 webkit_glue::SetMediaPlayerAvailable(true); |
160 } | 145 } |
161 } | 146 } |
162 | 147 |
163 bool RenderProcess::InProcessPlugins() { | 148 bool RenderProcess::InProcessPlugins() { |
164 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 149 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
165 return command_line.HasSwitch(switches::kInProcessPlugins) || | 150 return command_line.HasSwitch(switches::kInProcessPlugins) || |
166 command_line.HasSwitch(switches::kSingleProcess); | 151 command_line.HasSwitch(switches::kSingleProcess); |
167 } | 152 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 279 } |
295 | 280 |
296 void RenderProcess::ClearTransportDIBCache() { | 281 void RenderProcess::ClearTransportDIBCache() { |
297 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { | 282 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { |
298 if (shared_mem_cache_[i]) { | 283 if (shared_mem_cache_[i]) { |
299 FreeTransportDIB(shared_mem_cache_[i]); | 284 FreeTransportDIB(shared_mem_cache_[i]); |
300 shared_mem_cache_[i] = NULL; | 285 shared_mem_cache_[i] = NULL; |
301 } | 286 } |
302 } | 287 } |
303 } | 288 } |
OLD | NEW |