Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: chrome/renderer/render_process_impl.cc

Issue 2080016: Don't use command line flags for enabling the internal pdf plugin. Instead, ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/pref_names.cc ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 media::InitializeMediaLibrary(module_path); 156 media::InitializeMediaLibrary(module_path);
157 157
158 // TODO(hclam): Add more checks here. Currently this is not used. 158 // TODO(hclam): Add more checks here. Currently this is not used.
159 if (CommandLine::ForCurrentProcess()->HasSwitch( 159 if (CommandLine::ForCurrentProcess()->HasSwitch(
160 switches::kEnableOpenMax)) { 160 switches::kEnableOpenMax)) {
161 media::InitializeOpenMaxLibrary(module_path); 161 media::InitializeOpenMaxLibrary(module_path);
162 } 162 }
163 #endif 163 #endif
164 164
165 // Load the pdf plugin before the sandbox is turned on. 165 // Load the pdf plugin before the sandbox is turned on.
166 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalPDF)) { 166 FilePath pdf;
167 FilePath pdf; 167 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf)) {
168 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf)) { 168 static scoped_refptr<NPAPI::PluginLib> pdf_lib =
169 static scoped_refptr<NPAPI::PluginLib> pdf_lib = 169 NPAPI::PluginLib::CreatePluginLib(pdf);
170 NPAPI::PluginLib::CreatePluginLib(pdf); 170 // Actually load the plugin.
171 // Actually load the plugin. 171 pdf_lib->NP_Initialize();
172 pdf_lib->NP_Initialize(); 172 // Keep an instance around to prevent the plugin unloading after a pdf is
173 // Keep an instance around to prevent the plugin unloading after a pdf is 173 // closed.
174 // closed. 174 // Don't use scoped_ptr here because then get asserts on process shut down
175 // Don't use scoped_ptr here because then get asserts on process shut down 175 // when running in --single-process.
176 // when running in --single-process. 176 static NPAPI::PluginInstance* instance = pdf_lib->CreateInstance("");
177 static NPAPI::PluginInstance* instance = pdf_lib->CreateInstance(""); 177 instance->plugin_lib(); // Quiet unused variable warnings in gcc.
178 instance->plugin_lib(); // Quiet unused variable warnings in gcc.
179 178
180 #if defined(OS_WIN) 179 #if defined(OS_WIN)
181 g_iat_patch_createdca.Patch( 180 g_iat_patch_createdca.Patch(
182 pdf_lib->plugin_info().path.value().c_str(), 181 pdf_lib->plugin_info().path.value().c_str(),
183 "gdi32.dll", "CreateDCA", CreateDCAPatch); 182 "gdi32.dll", "CreateDCA", CreateDCAPatch);
184 #endif 183 #endif
185 }
186 } 184 }
187 } 185 }
188 186
189 RenderProcessImpl::~RenderProcessImpl() { 187 RenderProcessImpl::~RenderProcessImpl() {
190 // TODO(port): Try and limit what we pull in for our non-Win unit test bundle. 188 // TODO(port): Try and limit what we pull in for our non-Win unit test bundle.
191 #ifndef NDEBUG 189 #ifndef NDEBUG
192 // log important leaked objects 190 // log important leaked objects
193 webkit_glue::CheckForLeaks(); 191 webkit_glue::CheckForLeaks();
194 #endif 192 #endif
195 193
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 344 }
347 345
348 void RenderProcessImpl::ClearTransportDIBCache() { 346 void RenderProcessImpl::ClearTransportDIBCache() {
349 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { 347 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) {
350 if (shared_mem_cache_[i]) { 348 if (shared_mem_cache_[i]) {
351 FreeTransportDIB(shared_mem_cache_[i]); 349 FreeTransportDIB(shared_mem_cache_[i]);
352 shared_mem_cache_[i] = NULL; 350 shared_mem_cache_[i] = NULL;
353 } 351 }
354 } 352 }
355 } 353 }
OLDNEW
« no previous file with comments | « chrome/common/pref_names.cc ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698