Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utility/utility_thread_impl.h" | 5 #include "content/utility/utility_thread_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #if defined(TOOLKIT_USES_GTK) | |
| 10 #include <gtk/gtk.h> | |
| 11 #endif | |
| 12 | |
| 9 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 10 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 11 #include "content/common/child_process.h" | 15 #include "content/common/child_process.h" |
| 12 #include "content/common/child_process_messages.h" | 16 #include "content/common/child_process_messages.h" |
| 13 #include "content/common/indexed_db_key.h" | 17 #include "content/common/indexed_db_key.h" |
| 14 #include "content/common/utility_messages.h" | 18 #include "content/common/utility_messages.h" |
| 15 #include "content/common/webkitplatformsupport_impl.h" | 19 #include "content/common/webkitplatformsupport_impl.h" |
| 16 #include "content/public/utility/content_utility_client.h" | 20 #include "content/public/utility/content_utility_client.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 void UtilityThreadImpl::OnBatchModeFinished() { | 124 void UtilityThreadImpl::OnBatchModeFinished() { |
| 121 ChildProcess::current()->ReleaseProcess(); | 125 ChildProcess::current()->ReleaseProcess(); |
| 122 } | 126 } |
| 123 | 127 |
| 124 #if defined(OS_POSIX) | 128 #if defined(OS_POSIX) |
| 125 void UtilityThreadImpl::OnLoadPlugins( | 129 void UtilityThreadImpl::OnLoadPlugins( |
| 126 const std::vector<FilePath>& plugin_paths) { | 130 const std::vector<FilePath>& plugin_paths) { |
| 127 webkit::npapi::PluginList* plugin_list = | 131 webkit::npapi::PluginList* plugin_list = |
| 128 webkit::npapi::PluginList::Singleton(); | 132 webkit::npapi::PluginList::Singleton(); |
| 129 | 133 |
| 134 // On Linux, some plugins expect the browser to have loaded glib/gtk. Do that | |
| 135 // before attempting to call into the plugin. | |
| 136 #if defined(TOOLKIT_USES_GTK) | |
| 137 g_thread_init(NULL); | |
|
piman
2011/12/02 18:13:39
It seems that we should do that once and for all i
Robert Sesek
2011/12/02 18:37:44
Why? The only IPC message that requires this is Lo
piman
2011/12/02 18:45:21
Today. If you want to leave things here, then plea
Robert Sesek
2011/12/02 19:19:42
Moving to ctor > adding an assert. Done.
| |
| 138 #endif | |
| 139 | |
| 130 for (size_t i = 0; i < plugin_paths.size(); ++i) { | 140 for (size_t i = 0; i < plugin_paths.size(); ++i) { |
| 131 ScopedVector<webkit::npapi::PluginGroup> plugin_groups; | 141 ScopedVector<webkit::npapi::PluginGroup> plugin_groups; |
| 132 plugin_list->LoadPlugin(plugin_paths[i], &plugin_groups); | 142 plugin_list->LoadPlugin(plugin_paths[i], &plugin_groups); |
| 133 | 143 |
| 134 if (plugin_groups.empty()) { | 144 if (plugin_groups.empty()) { |
| 135 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); | 145 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); |
| 136 continue; | 146 continue; |
| 137 } | 147 } |
| 138 | 148 |
| 139 const webkit::npapi::PluginGroup* group = plugin_groups[0]; | 149 const webkit::npapi::PluginGroup* group = plugin_groups[0]; |
| 140 DCHECK_EQ(group->web_plugin_infos().size(), 1u); | 150 DCHECK_EQ(group->web_plugin_infos().size(), 1u); |
| 141 | 151 |
| 142 Send(new UtilityHostMsg_LoadedPlugin(i, group->web_plugin_infos().front())); | 152 Send(new UtilityHostMsg_LoadedPlugin(i, group->web_plugin_infos().front())); |
| 143 } | 153 } |
| 144 | 154 |
| 145 ReleaseProcessIfNeeded(); | 155 ReleaseProcessIfNeeded(); |
| 146 } | 156 } |
| 147 #endif | 157 #endif |
| 148 | 158 |
| OLD | NEW |