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

Side by Side Diff: extensions/browser/serial_extension_host_queue.cc

Issue 2036863002: Remove use of deprecated MessageLoop methods in extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « extensions/browser/process_manager.cc ('k') | extensions/browser/state_store.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "extensions/browser/serial_extension_host_queue.h" 5 #include "extensions/browser/serial_extension_host_queue.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
9 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/threading/thread_task_runner_handle.h"
10 #include "base/time/time.h" 12 #include "base/time/time.h"
11 #include "components/variations/variations_associated_data.h" 13 #include "components/variations/variations_associated_data.h"
12 #include "extensions/browser/deferred_start_render_host.h" 14 #include "extensions/browser/deferred_start_render_host.h"
13 15
14 namespace extensions { 16 namespace extensions {
15 17
16 namespace { 18 namespace {
17 19
18 // Gets the number of milliseconds to delay between loading ExtensionHosts. By 20 // Gets the number of milliseconds to delay between loading ExtensionHosts. By
19 // default this is 0, but it can be overridden by field trials. 21 // default this is 0, but it can be overridden by field trials.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 56
55 void SerialExtensionHostQueue::Remove(DeferredStartRenderHost* host) { 57 void SerialExtensionHostQueue::Remove(DeferredStartRenderHost* host) {
56 std::list<DeferredStartRenderHost*>::iterator it = 58 std::list<DeferredStartRenderHost*>::iterator it =
57 std::find(queue_.begin(), queue_.end(), host); 59 std::find(queue_.begin(), queue_.end(), host);
58 if (it != queue_.end()) 60 if (it != queue_.end())
59 queue_.erase(it); 61 queue_.erase(it);
60 } 62 }
61 63
62 void SerialExtensionHostQueue::PostTask() { 64 void SerialExtensionHostQueue::PostTask() {
63 if (!pending_create_) { 65 if (!pending_create_) {
64 base::MessageLoop::current()->PostDelayedTask( 66 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
65 FROM_HERE, base::Bind(&SerialExtensionHostQueue::ProcessOneHost, 67 FROM_HERE, base::Bind(&SerialExtensionHostQueue::ProcessOneHost,
66 ptr_factory_.GetWeakPtr()), 68 ptr_factory_.GetWeakPtr()),
67 base::TimeDelta::FromMilliseconds(GetDelayMs())); 69 base::TimeDelta::FromMilliseconds(GetDelayMs()));
68 pending_create_ = true; 70 pending_create_ = true;
69 } 71 }
70 } 72 }
71 73
72 void SerialExtensionHostQueue::ProcessOneHost() { 74 void SerialExtensionHostQueue::ProcessOneHost() {
73 pending_create_ = false; 75 pending_create_ = false;
74 if (queue_.empty()) 76 if (queue_.empty())
75 return; // can happen on shutdown 77 return; // can happen on shutdown
76 78
77 queue_.front()->CreateRenderViewNow(); 79 queue_.front()->CreateRenderViewNow();
78 queue_.pop_front(); 80 queue_.pop_front();
79 81
80 if (!queue_.empty()) 82 if (!queue_.empty())
81 PostTask(); 83 PostTask();
82 } 84 }
83 85
84 } // namespace extensions 86 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/process_manager.cc ('k') | extensions/browser/state_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698