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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 | 125 |
126 if (command_line.HasSwitch(switches::kEnableWatchdog)) { | 126 if (command_line.HasSwitch(switches::kEnableWatchdog)) { |
127 // TODO(JAR): Need to implement renderer IO msgloop watchdog. | 127 // TODO(JAR): Need to implement renderer IO msgloop watchdog. |
128 } | 128 } |
129 | 129 |
130 if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { | 130 if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { |
131 base::StatisticsRecorder::set_dump_on_exit(true); | 131 base::StatisticsRecorder::set_dump_on_exit(true); |
132 } | 132 } |
133 | 133 |
134 #if defined(OS_MACOSX) | 134 // Note that under Linux, the media library will normally already have |
135 FilePath bundle_path = base::mac::MainAppBundlePath(); | 135 // been initialized by the Zygote before this instance became a Renderer. |
| 136 FilePath media_path; |
| 137 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path)) |
| 138 media::InitializeMediaLibrary(media_path); |
136 | 139 |
137 initialized_media_library_ = | 140 #if !defined(OS_MACOSX) |
138 media::InitializeMediaLibrary(bundle_path.Append("Libraries")); | |
139 #else | |
140 FilePath module_path; | |
141 initialized_media_library_ = | |
142 PathService::Get(base::DIR_MODULE, &module_path) && | |
143 media::InitializeMediaLibrary(module_path); | |
144 | |
145 // TODO(hclam): Add more checks here. Currently this is not used. | 141 // TODO(hclam): Add more checks here. Currently this is not used. |
146 if (CommandLine::ForCurrentProcess()->HasSwitch( | 142 if (media::IsMediaLibraryInitialized() && |
| 143 CommandLine::ForCurrentProcess()->HasSwitch( |
147 switches::kEnableOpenMax)) { | 144 switches::kEnableOpenMax)) { |
148 media::InitializeOpenMaxLibrary(module_path); | 145 media::InitializeOpenMaxLibrary(media_path); |
149 } | 146 } |
150 #endif | 147 #endif |
151 | 148 |
152 #if defined(OS_WIN) | 149 #if defined(OS_WIN) |
153 // Need to patch a few functions for font loading to work correctly. | 150 // Need to patch a few functions for font loading to work correctly. |
154 FilePath pdf; | 151 FilePath pdf; |
155 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) && | 152 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) && |
156 file_util::PathExists(pdf)) { | 153 file_util::PathExists(pdf)) { |
157 g_iat_patch_createdca.Patch( | 154 g_iat_patch_createdca.Patch( |
158 pdf.value().c_str(), "gdi32.dll", "CreateDCA", CreateDCAPatch); | 155 pdf.value().c_str(), "gdi32.dll", "CreateDCA", CreateDCAPatch); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 267 } |
271 | 268 |
272 FreeTransportDIB(mem); | 269 FreeTransportDIB(mem); |
273 } | 270 } |
274 | 271 |
275 bool RenderProcessImpl::UseInProcessPlugins() const { | 272 bool RenderProcessImpl::UseInProcessPlugins() const { |
276 return in_process_plugins_; | 273 return in_process_plugins_; |
277 } | 274 } |
278 | 275 |
279 bool RenderProcessImpl::HasInitializedMediaLibrary() const { | 276 bool RenderProcessImpl::HasInitializedMediaLibrary() const { |
280 return initialized_media_library_; | 277 return media::IsMediaLibraryInitialized(); |
281 } | 278 } |
282 | 279 |
283 bool RenderProcessImpl::GetTransportDIBFromCache(TransportDIB** mem, | 280 bool RenderProcessImpl::GetTransportDIBFromCache(TransportDIB** mem, |
284 size_t size) { | 281 size_t size) { |
285 // look for a cached object that is suitable for the requested size. | 282 // look for a cached object that is suitable for the requested size. |
286 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { | 283 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { |
287 if (shared_mem_cache_[i] && | 284 if (shared_mem_cache_[i] && |
288 size <= shared_mem_cache_[i]->size()) { | 285 size <= shared_mem_cache_[i]->size()) { |
289 *mem = shared_mem_cache_[i]; | 286 *mem = shared_mem_cache_[i]; |
290 shared_mem_cache_[i] = NULL; | 287 shared_mem_cache_[i] = NULL; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 330 } |
334 | 331 |
335 void RenderProcessImpl::ClearTransportDIBCache() { | 332 void RenderProcessImpl::ClearTransportDIBCache() { |
336 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { | 333 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { |
337 if (shared_mem_cache_[i]) { | 334 if (shared_mem_cache_[i]) { |
338 FreeTransportDIB(shared_mem_cache_[i]); | 335 FreeTransportDIB(shared_mem_cache_[i]); |
339 shared_mem_cache_[i] = NULL; | 336 shared_mem_cache_[i] = NULL; |
340 } | 337 } |
341 } | 338 } |
342 } | 339 } |
OLD | NEW |