Use multiline attribute to check for IA2_STATE_MULTILINE.
[chromium-blink-merge.git] / content / browser / streams / stream_handle_impl.cc
blob5bc2acbf4fa8f95cebc6fb765084a460f1098382
1 // Copyright (c) 2013 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 "content/browser/streams/stream_handle_impl.h"
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h"
10 #include "content/browser/streams/stream.h"
12 namespace content {
14 namespace {
16 void RunCloseListeners(const std::vector<base::Closure>& close_listeners) {
17 for (size_t i = 0; i < close_listeners.size(); ++i)
18 close_listeners[i].Run();
21 } // namespace
23 StreamHandleImpl::StreamHandleImpl(const base::WeakPtr<Stream>& stream)
24 : stream_(stream),
25 url_(stream->url()),
26 stream_message_loop_(base::MessageLoopProxy::current().get()) {}
28 StreamHandleImpl::~StreamHandleImpl() {
29 stream_message_loop_->PostTaskAndReply(FROM_HERE,
30 base::Bind(&Stream::CloseHandle, stream_),
31 base::Bind(&RunCloseListeners, close_listeners_));
34 const GURL& StreamHandleImpl::GetURL() {
35 return url_;
38 void StreamHandleImpl::AddCloseListener(const base::Closure& callback) {
39 close_listeners_.push_back(callback);
42 } // namespace content