Remove unused parameter.
[chromium-blink-merge.git] / extensions / browser / serial_extension_host_queue.cc
blob7986523c69d6d76a806d5b1cecc3738d7039ceeb
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
3 // found in the LICENSE file.
5 #include "extensions/browser/serial_extension_host_queue.h"
7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h"
9 #include "extensions/browser/deferred_start_render_host.h"
11 namespace extensions {
13 SerialExtensionHostQueue::SerialExtensionHostQueue()
14 : pending_create_(false), ptr_factory_(this) {
17 SerialExtensionHostQueue::~SerialExtensionHostQueue() {
20 void SerialExtensionHostQueue::Add(DeferredStartRenderHost* host) {
21 queue_.push_back(host);
22 PostTask();
25 void SerialExtensionHostQueue::Remove(DeferredStartRenderHost* host) {
26 std::list<DeferredStartRenderHost*>::iterator it =
27 std::find(queue_.begin(), queue_.end(), host);
28 if (it != queue_.end())
29 queue_.erase(it);
32 void SerialExtensionHostQueue::PostTask() {
33 if (!pending_create_) {
34 base::MessageLoop::current()->PostTask(
35 FROM_HERE, base::Bind(&SerialExtensionHostQueue::ProcessOneHost,
36 ptr_factory_.GetWeakPtr()));
37 pending_create_ = true;
41 void SerialExtensionHostQueue::ProcessOneHost() {
42 pending_create_ = false;
43 if (queue_.empty())
44 return; // can happen on shutdown
46 queue_.front()->CreateRenderViewNow();
47 queue_.pop_front();
49 if (!queue_.empty())
50 PostTask();
53 } // namespace extensions