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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 | 124 |
125 if (command_line.HasSwitch(switches::kEnableWatchdog)) { | 125 if (command_line.HasSwitch(switches::kEnableWatchdog)) { |
126 // TODO(JAR): Need to implement renderer IO msgloop watchdog. | 126 // TODO(JAR): Need to implement renderer IO msgloop watchdog. |
127 } | 127 } |
128 | 128 |
129 if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { | 129 if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { |
130 base::StatisticsRecorder::set_dump_on_exit(true); | 130 base::StatisticsRecorder::set_dump_on_exit(true); |
131 } | 131 } |
132 | 132 |
133 #if defined(OS_MACOSX) | 133 // Note that under Linux, the media library will normally already have |
134 FilePath bundle_path = base::mac::MainAppBundlePath(); | 134 // been initialized by the Zygote before this instance became a Renderer. |
| 135 FilePath media_path; |
| 136 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path)) |
| 137 media::InitializeMediaLibrary(media_path); |
135 | 138 |
136 initialized_media_library_ = | 139 #if !defined(OS_MACOSX) |
137 media::InitializeMediaLibrary(bundle_path.Append("Libraries")); | |
138 #else | |
139 FilePath module_path; | |
140 initialized_media_library_ = | |
141 PathService::Get(base::DIR_MODULE, &module_path) && | |
142 media::InitializeMediaLibrary(module_path); | |
143 | |
144 // TODO(hclam): Add more checks here. Currently this is not used. | 140 // TODO(hclam): Add more checks here. Currently this is not used. |
145 if (CommandLine::ForCurrentProcess()->HasSwitch( | 141 if (media::IsMediaLibraryInitialized() && |
| 142 CommandLine::ForCurrentProcess()->HasSwitch( |
146 switches::kEnableOpenMax)) { | 143 switches::kEnableOpenMax)) { |
147 media::InitializeOpenMaxLibrary(module_path); | 144 media::InitializeOpenMaxLibrary(media_path); |
148 } | 145 } |
149 #endif | 146 #endif |
150 | 147 |
151 #if defined(OS_WIN) | 148 #if defined(OS_WIN) |
152 // Need to patch a few functions for font loading to work correctly. | 149 // Need to patch a few functions for font loading to work correctly. |
153 FilePath pdf; | 150 FilePath pdf; |
154 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) && | 151 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) && |
155 file_util::PathExists(pdf)) { | 152 file_util::PathExists(pdf)) { |
156 g_iat_patch_createdca.Patch( | 153 g_iat_patch_createdca.Patch( |
157 pdf.value().c_str(), "gdi32.dll", "CreateDCA", CreateDCAPatch); | 154 pdf.value().c_str(), "gdi32.dll", "CreateDCA", CreateDCAPatch); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 255 } |
259 | 256 |
260 FreeTransportDIB(mem); | 257 FreeTransportDIB(mem); |
261 } | 258 } |
262 | 259 |
263 bool RenderProcessImpl::UseInProcessPlugins() const { | 260 bool RenderProcessImpl::UseInProcessPlugins() const { |
264 return in_process_plugins_; | 261 return in_process_plugins_; |
265 } | 262 } |
266 | 263 |
267 bool RenderProcessImpl::HasInitializedMediaLibrary() const { | 264 bool RenderProcessImpl::HasInitializedMediaLibrary() const { |
268 return initialized_media_library_; | 265 return media::IsMediaLibraryInitialized(); |
269 } | 266 } |
270 | 267 |
271 bool RenderProcessImpl::GetTransportDIBFromCache(TransportDIB** mem, | 268 bool RenderProcessImpl::GetTransportDIBFromCache(TransportDIB** mem, |
272 size_t size) { | 269 size_t size) { |
273 // look for a cached object that is suitable for the requested size. | 270 // look for a cached object that is suitable for the requested size. |
274 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { | 271 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { |
275 if (shared_mem_cache_[i] && | 272 if (shared_mem_cache_[i] && |
276 size <= shared_mem_cache_[i]->size()) { | 273 size <= shared_mem_cache_[i]->size()) { |
277 *mem = shared_mem_cache_[i]; | 274 *mem = shared_mem_cache_[i]; |
278 shared_mem_cache_[i] = NULL; | 275 shared_mem_cache_[i] = NULL; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 318 } |
322 | 319 |
323 void RenderProcessImpl::ClearTransportDIBCache() { | 320 void RenderProcessImpl::ClearTransportDIBCache() { |
324 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { | 321 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { |
325 if (shared_mem_cache_[i]) { | 322 if (shared_mem_cache_[i]) { |
326 FreeTransportDIB(shared_mem_cache_[i]); | 323 FreeTransportDIB(shared_mem_cache_[i]); |
327 shared_mem_cache_[i] = NULL; | 324 shared_mem_cache_[i] = NULL; |
328 } | 325 } |
329 } | 326 } |
330 } | 327 } |
OLD | NEW |