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

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

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « content/browser/plugin_loader_posix.h ('k') | content/browser/plugin_service_impl.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_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/location.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/message_loop/message_loop_proxy.h"
9 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
10 #include "base/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h"
12 #include "content/browser/utility_process_host_impl.h" 11 #include "content/browser/utility_process_host_impl.h"
13 #include "content/common/child_process_host_impl.h" 12 #include "content/common/child_process_host_impl.h"
14 #include "content/common/plugin_list.h" 13 #include "content/common/plugin_list.h"
15 #include "content/common/utility_messages.h" 14 #include "content/common/utility_messages.h"
16 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/plugin_service.h" 16 #include "content/public/browser/plugin_service.h"
18 #include "content/public/browser/user_metrics.h" 17 #include "content/public/browser/user_metrics.h"
19 18
20 namespace content { 19 namespace content {
21 20
22 PluginLoaderPosix::PluginLoaderPosix() 21 PluginLoaderPosix::PluginLoaderPosix()
23 : next_load_index_(0), loading_plugins_(false) { 22 : next_load_index_(0), loading_plugins_(false) {
24 } 23 }
25 24
26 void PluginLoaderPosix::GetPlugins( 25 void PluginLoaderPosix::GetPlugins(
27 const PluginService::GetPluginsCallback& callback) { 26 const PluginService::GetPluginsCallback& callback) {
28 DCHECK_CURRENTLY_ON(BrowserThread::IO); 27 DCHECK_CURRENTLY_ON(BrowserThread::IO);
29 28
30 std::vector<WebPluginInfo> cached_plugins; 29 std::vector<WebPluginInfo> cached_plugins;
31 if (PluginList::Singleton()->GetPluginsNoRefresh(&cached_plugins)) { 30 if (PluginList::Singleton()->GetPluginsNoRefresh(&cached_plugins)) {
32 // Can't assume the caller is reentrant. 31 // Can't assume the caller is reentrant.
33 base::ThreadTaskRunnerHandle::Get()->PostTask( 32 base::MessageLoop::current()->PostTask(FROM_HERE,
34 FROM_HERE, base::Bind(callback, cached_plugins)); 33 base::Bind(callback, cached_plugins));
35 return; 34 return;
36 } 35 }
37 36
38 if (!loading_plugins_) { 37 if (!loading_plugins_) {
39 loading_plugins_ = true; 38 loading_plugins_ = true;
40 callbacks_.push_back(callback); 39 callbacks_.push_back(callback);
41 40
42 // When |loading_plugins_| is set to false, this instance must call 41 // When |loading_plugins_| is set to false, this instance must call
43 // SetPlugins(). 42 // SetPlugins().
44 PluginList::Singleton()->PrepareForPluginLoading(); 43 PluginList::Singleton()->PrepareForPluginLoading();
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 219
221 DCHECK(next_load_index_ <= canonical_list_.size()); 220 DCHECK(next_load_index_ <= canonical_list_.size());
222 return next_load_index_ == canonical_list_.size(); 221 return next_load_index_ == canonical_list_.size();
223 } 222 }
224 223
225 void PluginLoaderPosix::FinishedLoadingPlugins() { 224 void PluginLoaderPosix::FinishedLoadingPlugins() {
226 loading_plugins_ = false; 225 loading_plugins_ = false;
227 PluginList::Singleton()->SetPlugins(loaded_plugins_); 226 PluginList::Singleton()->SetPlugins(loaded_plugins_);
228 227
229 for (auto& callback : callbacks_) { 228 for (auto& callback : callbacks_) {
230 base::ThreadTaskRunnerHandle::Get()->PostTask( 229 base::MessageLoop::current()->PostTask(
231 FROM_HERE, base::Bind(callback, loaded_plugins_)); 230 FROM_HERE, base::Bind(callback, loaded_plugins_));
232 } 231 }
233 callbacks_.clear(); 232 callbacks_.clear();
234 } 233 }
235 234
236 bool PluginLoaderPosix::LaunchUtilityProcess() { 235 bool PluginLoaderPosix::LaunchUtilityProcess() {
237 return process_host_->Send(new UtilityMsg_LoadPlugins(canonical_list_)); 236 return process_host_->Send(new UtilityMsg_LoadPlugins(canonical_list_));
238 } 237 }
239 238
240 } // namespace content 239 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/plugin_loader_posix.h ('k') | content/browser/plugin_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698