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

Side by Side Diff: content/browser/plugin_service_impl.cc

Issue 10014013: Add a hang monitor for Pepper plugins (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « content/browser/plugin_service_impl.h ('k') | content/browser/ppapi_plugin_process_host.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/plugin_service_impl.h" 5 #include "content/browser/plugin_service_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 void PluginServiceImpl::OpenChannelToPpapiPlugin( 335 void PluginServiceImpl::OpenChannelToPpapiPlugin(
336 const FilePath& path, 336 const FilePath& path,
337 PpapiPluginProcessHost::PluginClient* client) { 337 PpapiPluginProcessHost::PluginClient* client) {
338 PpapiPluginProcessHost* plugin_host = FindOrStartPpapiPluginProcess( 338 PpapiPluginProcessHost* plugin_host = FindOrStartPpapiPluginProcess(
339 path, client); 339 path, client);
340 if (plugin_host) { 340 if (plugin_host) {
341 plugin_host->OpenChannelToPlugin(client); 341 plugin_host->OpenChannelToPlugin(client);
342 } else { 342 } else {
343 // Send error. 343 // Send error.
344 client->OnPpapiChannelOpened(base::kNullProcessHandle, 344 client->OnPpapiChannelOpened(base::kNullProcessHandle,
345 IPC::ChannelHandle()); 345 IPC::ChannelHandle(), 0);
346 } 346 }
347 } 347 }
348 348
349 void PluginServiceImpl::OpenChannelToPpapiBroker( 349 void PluginServiceImpl::OpenChannelToPpapiBroker(
350 const FilePath& path, 350 const FilePath& path,
351 PpapiPluginProcessHost::BrokerClient* client) { 351 PpapiPluginProcessHost::BrokerClient* client) {
352 PpapiPluginProcessHost* plugin_host = FindOrStartPpapiBrokerProcess(path); 352 PpapiPluginProcessHost* plugin_host = FindOrStartPpapiBrokerProcess(path);
353 if (plugin_host) { 353 if (plugin_host) {
354 plugin_host->OpenChannelToPlugin(client); 354 plugin_host->OpenChannelToPlugin(client);
355 } else { 355 } else {
356 // Send error. 356 // Send error.
357 client->OnPpapiChannelOpened(base::kNullProcessHandle, 357 client->OnPpapiChannelOpened(base::kNullProcessHandle,
358 IPC::ChannelHandle()); 358 IPC::ChannelHandle(), 0);
359 } 359 }
360 } 360 }
361 361
362 void PluginServiceImpl::CancelOpenChannelToNpapiPlugin( 362 void PluginServiceImpl::CancelOpenChannelToNpapiPlugin(
363 PluginProcessHost::Client* client) { 363 PluginProcessHost::Client* client) {
364 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 364 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
365 DCHECK(ContainsKey(pending_plugin_clients_, client)); 365 DCHECK(ContainsKey(pending_plugin_clients_, client));
366 pending_plugin_clients_.erase(client); 366 pending_plugin_clients_.erase(client);
367 } 367 }
368 368
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 ++it) { 476 ++it) {
477 if (it->path == plugin_path) { 477 if (it->path == plugin_path) {
478 *info = *it; 478 *info = *it;
479 return true; 479 return true;
480 } 480 }
481 } 481 }
482 482
483 return false; 483 return false;
484 } 484 }
485 485
486 string16 PluginServiceImpl::GetPluginDisplayNameByPath(const FilePath& path) {
487 string16 plugin_name = path.LossyDisplayName();
488 webkit::WebPluginInfo info;
489 if (PluginService::GetInstance()->GetPluginInfoByPath(path, &info) &&
490 !info.name.empty()) {
491 plugin_name = info.name;
492 #if defined(OS_MACOSX)
493 // Many plugins on the Mac have .plugin in the actual name, which looks
494 // terrible, so look for that and strip it off if present.
495 const std::string kPluginExtension = ".plugin";
496 if (EndsWith(plugin_name, ASCIIToUTF16(kPluginExtension), true))
497 plugin_name.erase(plugin_name.length() - kPluginExtension.length());
498 #endif // OS_MACOSX
499 }
500 return plugin_name;
501 }
502
486 void PluginServiceImpl::GetPlugins(const GetPluginsCallback& callback) { 503 void PluginServiceImpl::GetPlugins(const GetPluginsCallback& callback) {
487 scoped_refptr<base::MessageLoopProxy> target_loop( 504 scoped_refptr<base::MessageLoopProxy> target_loop(
488 MessageLoop::current()->message_loop_proxy()); 505 MessageLoop::current()->message_loop_proxy());
489 506
490 #if defined(OS_WIN) 507 #if defined(OS_WIN)
491 BrowserThread::GetBlockingPool()->PostWorkerTaskWithShutdownBehavior( 508 BrowserThread::GetBlockingPool()->PostWorkerTaskWithShutdownBehavior(
492 FROM_HERE, 509 FROM_HERE,
493 base::Bind(&PluginServiceImpl::GetPluginsInternal, base::Unretained(this), 510 base::Bind(&PluginServiceImpl::GetPluginsInternal, base::Unretained(this),
494 target_loop, callback), 511 target_loop, callback),
495 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); 512 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 plugin_list_->RegisterInternalPlugin(info, add_at_beginning); 709 plugin_list_->RegisterInternalPlugin(info, add_at_beginning);
693 } 710 }
694 711
695 string16 PluginServiceImpl::GetPluginGroupName(const std::string& plugin_name) { 712 string16 PluginServiceImpl::GetPluginGroupName(const std::string& plugin_name) {
696 return plugin_list_->GetPluginGroupName(plugin_name); 713 return plugin_list_->GetPluginGroupName(plugin_name);
697 } 714 }
698 715
699 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { 716 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() {
700 return plugin_list_; 717 return plugin_list_;
701 } 718 }
OLDNEW
« no previous file with comments | « content/browser/plugin_service_impl.h ('k') | content/browser/ppapi_plugin_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698