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

Side by Side Diff: content/browser/streams/stream_handle_impl.cc

Issue 1159623009: content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test build fix. 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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/streams/stream_handle_impl.h" 5 #include "content/browser/streams/stream_handle_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "content/browser/streams/stream.h" 10 #include "content/browser/streams/stream.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 namespace { 14 namespace {
15 15
16 void RunCloseListeners(const std::vector<base::Closure>& close_listeners) { 16 void RunCloseListeners(const std::vector<base::Closure>& close_listeners) {
17 for (size_t i = 0; i < close_listeners.size(); ++i) 17 for (size_t i = 0; i < close_listeners.size(); ++i)
18 close_listeners[i].Run(); 18 close_listeners[i].Run();
19 } 19 }
20 20
21 } // namespace 21 } // namespace
22 22
23 StreamHandleImpl::StreamHandleImpl(const base::WeakPtr<Stream>& stream) 23 StreamHandleImpl::StreamHandleImpl(const base::WeakPtr<Stream>& stream)
24 : stream_(stream), 24 : stream_(stream),
25 url_(stream->url()), 25 url_(stream->url()),
26 stream_message_loop_(base::MessageLoopProxy::current().get()) {} 26 stream_task_runner_(base::ThreadTaskRunnerHandle::Get().get()) {
27 }
27 28
28 StreamHandleImpl::~StreamHandleImpl() { 29 StreamHandleImpl::~StreamHandleImpl() {
29 stream_message_loop_->PostTaskAndReply(FROM_HERE, 30 stream_task_runner_->PostTaskAndReply(
30 base::Bind(&Stream::CloseHandle, stream_), 31 FROM_HERE, base::Bind(&Stream::CloseHandle, stream_),
31 base::Bind(&RunCloseListeners, close_listeners_)); 32 base::Bind(&RunCloseListeners, close_listeners_));
32 } 33 }
33 34
34 const GURL& StreamHandleImpl::GetURL() { 35 const GURL& StreamHandleImpl::GetURL() {
35 return url_; 36 return url_;
36 } 37 }
37 38
38 void StreamHandleImpl::AddCloseListener(const base::Closure& callback) { 39 void StreamHandleImpl::AddCloseListener(const base::Closure& callback) {
39 close_listeners_.push_back(callback); 40 close_listeners_.push_back(callback);
40 } 41 }
41 42
42 } // namespace content 43 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/streams/stream_handle_impl.h ('k') | content/browser/streams/stream_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698