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/browser/plugin_loader_posix.h" | 5 #include "content/browser/plugin_loader_posix.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 process_host_ = new UtilityProcessHost(this, BrowserThread::IO); | 95 process_host_ = new UtilityProcessHost(this, BrowserThread::IO); |
96 process_host_->set_no_sandbox(true); | 96 process_host_->set_no_sandbox(true); |
97 #if defined(OS_MACOSX) | 97 #if defined(OS_MACOSX) |
98 process_host_->set_child_flags(ChildProcessHost::CHILD_ALLOW_HEAP_EXECUTION); | 98 process_host_->set_child_flags(ChildProcessHost::CHILD_ALLOW_HEAP_EXECUTION); |
99 #endif | 99 #endif |
100 | 100 |
101 process_host_->Send(new UtilityMsg_LoadPlugins(canonical_list_)); | 101 process_host_->Send(new UtilityMsg_LoadPlugins(canonical_list_)); |
102 } | 102 } |
103 | 103 |
104 void PluginLoaderPosix::OnPluginLoaded(const webkit::WebPluginInfo& plugin) { | 104 void PluginLoaderPosix::OnPluginLoaded(size_t index, |
105 if (plugin.path.value() != canonical_list_[next_load_index_].value()) { | 105 const webkit::WebPluginInfo& plugin) { |
| 106 if (index != next_load_index_) { |
106 LOG(ERROR) << "Received unexpected plugin load message for " | 107 LOG(ERROR) << "Received unexpected plugin load message for " |
107 << plugin.path.value(); | 108 << plugin.path.value() << "; index=" << index; |
108 return; | 109 return; |
109 } | 110 } |
110 | 111 |
111 if (!MaybeAddInternalPlugin(plugin.path)) | 112 if (!MaybeAddInternalPlugin(plugin.path)) |
112 loaded_plugins_.push_back(plugin); | 113 loaded_plugins_.push_back(plugin); |
113 | 114 |
114 ++next_load_index_; | 115 ++next_load_index_; |
115 | 116 |
116 MaybeRunPendingCallbacks(); | 117 MaybeRunPendingCallbacks(); |
117 } | 118 } |
118 | 119 |
119 void PluginLoaderPosix::OnPluginLoadFailed(const FilePath& plugin_path) { | 120 void PluginLoaderPosix::OnPluginLoadFailed(size_t index, |
120 if (plugin_path.value() != canonical_list_[next_load_index_].value()) { | 121 const FilePath& plugin_path) { |
| 122 if (index != next_load_index_) { |
121 LOG(ERROR) << "Received unexpected plugin load failure message for " | 123 LOG(ERROR) << "Received unexpected plugin load failure message for " |
122 << plugin_path.value(); | 124 << plugin_path.value() << "; index=" << index; |
123 return; | 125 return; |
124 } | 126 } |
125 | 127 |
126 ++next_load_index_; | 128 ++next_load_index_; |
127 | 129 |
128 MaybeAddInternalPlugin(plugin_path); | 130 MaybeAddInternalPlugin(plugin_path); |
129 MaybeRunPendingCallbacks(); | 131 MaybeRunPendingCallbacks(); |
130 } | 132 } |
131 | 133 |
132 bool PluginLoaderPosix::MaybeAddInternalPlugin(const FilePath& plugin_path) { | 134 bool PluginLoaderPosix::MaybeAddInternalPlugin(const FilePath& plugin_path) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 168 |
167 PluginLoaderPosix::PendingCallback::PendingCallback( | 169 PluginLoaderPosix::PendingCallback::PendingCallback( |
168 scoped_refptr<base::MessageLoopProxy> loop, | 170 scoped_refptr<base::MessageLoopProxy> loop, |
169 const PluginService::GetPluginsCallback& cb) | 171 const PluginService::GetPluginsCallback& cb) |
170 : target_loop(loop), | 172 : target_loop(loop), |
171 callback(cb) { | 173 callback(cb) { |
172 } | 174 } |
173 | 175 |
174 PluginLoaderPosix::PendingCallback::~PendingCallback() { | 176 PluginLoaderPosix::PendingCallback::~PendingCallback() { |
175 } | 177 } |
OLD | NEW |