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

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

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 | Annotate | Revision Log
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_url_request_job.h" 5 #include "content/browser/streams/stream_url_request_job.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "content/browser/streams/stream.h" 8 #include "content/browser/streams/stream.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 pending_buffer_size_ = 0; 65 pending_buffer_size_ = 0;
66 66
67 total_bytes_read_ += bytes_read; 67 total_bytes_read_ += bytes_read;
68 NotifyReadComplete(bytes_read); 68 NotifyReadComplete(bytes_read);
69 } 69 }
70 } 70 }
71 71
72 // net::URLRequestJob methods. 72 // net::URLRequestJob methods.
73 void StreamURLRequestJob::Start() { 73 void StreamURLRequestJob::Start() {
74 // Continue asynchronously. 74 // Continue asynchronously.
75 MessageLoop::current()->PostTask( 75 base::MessageLoop::current()->PostTask(
76 FROM_HERE, 76 FROM_HERE,
77 base::Bind(&StreamURLRequestJob::DidStart, weak_factory_.GetWeakPtr())); 77 base::Bind(&StreamURLRequestJob::DidStart, weak_factory_.GetWeakPtr()));
78 } 78 }
79 79
80 void StreamURLRequestJob::Kill() { 80 void StreamURLRequestJob::Kill() {
81 net::URLRequestJob::Kill(); 81 net::URLRequestJob::Kill();
82 weak_factory_.InvalidateWeakPtrs(); 82 weak_factory_.InvalidateWeakPtrs();
83 ClearStream(); 83 ClearStream();
84 } 84 }
85 85
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } 234 }
235 235
236 void StreamURLRequestJob::ClearStream() { 236 void StreamURLRequestJob::ClearStream() {
237 if (stream_) { 237 if (stream_) {
238 stream_->RemoveReadObserver(this); 238 stream_->RemoveReadObserver(this);
239 stream_ = NULL; 239 stream_ = NULL;
240 } 240 }
241 } 241 }
242 242
243 } // namespace content 243 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/streams/stream_unittest.cc ('k') | content/browser/streams/stream_url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698