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

Unified Diff: content/utility/utility_thread_impl.cc

Issue 8318028: Gracefully handle child process death in out-of-process plugin loading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, use sync messages. Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/utility/utility_thread_impl.cc
diff --git a/content/utility/utility_thread_impl.cc b/content/utility/utility_thread_impl.cc
index ca1a7e3b68676d9991c3e0e80006a8e4d1c90646..15126a449a4c993d59961f7a82361542f9a83f5c 100644
--- a/content/utility/utility_thread_impl.cc
+++ b/content/utility/utility_thread_impl.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include "base/file_path.h"
+#include "base/memory/scoped_vector.h"
#include "content/common/child_process.h"
#include "content/common/indexed_db_key.h"
#include "content/common/utility_messages.h"
@@ -107,34 +108,30 @@ void UtilityThreadImpl::OnBatchModeFinished() {
#if defined(OS_POSIX)
void UtilityThreadImpl::OnLoadPlugins(
- const std::vector<FilePath>& extra_plugin_paths,
- const std::vector<FilePath>& extra_plugin_dirs,
- const std::vector<webkit::WebPluginInfo>& internal_plugins) {
+ const std::vector<FilePath>& plugin_paths) {
webkit::npapi::PluginList* plugin_list =
webkit::npapi::PluginList::Singleton();
- // Create the PluginList and set the paths from which to load plugins. Iterate
- // in reverse to preserve the order when pushing back.
- std::vector<FilePath>::const_reverse_iterator it;
- for (it = extra_plugin_paths.rbegin();
- it != extra_plugin_paths.rend();
+ for (std::vector<FilePath>::const_iterator it = plugin_paths.begin();
+ it != plugin_paths.end();
++it) {
- plugin_list->AddExtraPluginPath(*it);
- }
- for (it = extra_plugin_dirs.rbegin(); it != extra_plugin_dirs.rend(); ++it) {
- plugin_list->AddExtraPluginDir(*it);
- }
- for (std::vector<webkit::WebPluginInfo>::const_reverse_iterator it =
- internal_plugins.rbegin();
- it != internal_plugins.rend();
- ++it) {
- plugin_list->RegisterInternalPlugin(*it);
- }
+ ScopedVector<webkit::npapi::PluginGroup> plugin_groups;
+ plugin_list->LoadPlugin(*it, &plugin_groups);
- std::vector<webkit::WebPluginInfo> plugins;
- plugin_list->GetPlugins(&plugins);
+ size_t index = std::distance(plugin_paths.begin(), it);
+
+ if (!plugin_groups.size()) {
jam 2011/10/20 00:16:16 nit: chrome style is if (plugin_groups.empty())
Robert Sesek 2011/10/20 16:00:21 Done.
+ Send(new UtilityHostMsg_LoadPluginFailed(index, *it));
+ continue;
+ }
+
+ const webkit::npapi::PluginGroup* group = plugin_groups[0];
+ DCHECK_EQ(group->web_plugin_infos().size(), 1u);
+
+ Send(new UtilityHostMsg_LoadedPlugin(index,
+ group->web_plugin_infos().front()));
+ }
- Send(new UtilityHostMsg_LoadedPlugins(plugins));
ReleaseProcessIfNeeded();
}
#endif

Powered by Google App Engine
This is Rietveld 408576698