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

Side by Side Diff: webkit/media/simple_data_source.cc

Issue 9344003: Fix re-entrancy bug in SimpleDataSource::Abort() introduced in r118338. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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
« no previous file with comments | « webkit/media/simple_data_source.h ('k') | webkit/media/simple_data_source_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/media/simple_data_source.h" 5 #include "webkit/media/simple_data_source.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "media/base/media_log.h" 10 #include "media/base/media_log.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 bool SimpleDataSource::HasSingleOrigin() { 263 bool SimpleDataSource::HasSingleOrigin() {
264 DCHECK(MessageLoop::current() == render_loop_); 264 DCHECK(MessageLoop::current() == render_loop_);
265 return single_origin_; 265 return single_origin_;
266 } 266 }
267 267
268 void SimpleDataSource::Abort() { 268 void SimpleDataSource::Abort() {
269 DCHECK(MessageLoop::current() == render_loop_); 269 DCHECK(MessageLoop::current() == render_loop_);
270 base::AutoLock auto_lock(lock_); 270 base::AutoLock auto_lock(lock_);
271 state_ = STOPPED; 271 state_ = STOPPED;
272 initialize_cb_.Reset(); 272 initialize_cb_.Reset();
273 CancelTask(); 273 CancelTask_Locked();
274 frame_ = NULL; 274 frame_ = NULL;
275 } 275 }
276 276
277 void SimpleDataSource::CancelTask() { 277 void SimpleDataSource::CancelTask() {
278 DCHECK(MessageLoop::current() == render_loop_); 278 DCHECK(MessageLoop::current() == render_loop_);
279 base::AutoLock auto_lock(lock_); 279 base::AutoLock auto_lock(lock_);
280 CancelTask_Locked();
281 }
282
283 void SimpleDataSource::CancelTask_Locked() {
284 DCHECK(MessageLoop::current() == render_loop_);
285 lock_.AssertAcquired();
280 DCHECK_EQ(state_, STOPPED); 286 DCHECK_EQ(state_, STOPPED);
281 287
282 // Cancel any pending requests. 288 // Cancel any pending requests.
283 if (url_loader_.get()) { 289 if (url_loader_.get()) {
284 url_loader_->cancel(); 290 url_loader_->cancel();
285 url_loader_.reset(); 291 url_loader_.reset();
286 } 292 }
287 } 293 }
288 294
289 void SimpleDataSource::DoneInitialization_Locked(bool success) { 295 void SimpleDataSource::DoneInitialization_Locked(bool success) {
(...skipping 14 matching lines...) Expand all
304 } 310 }
305 311
306 void SimpleDataSource::UpdateHostState() { 312 void SimpleDataSource::UpdateHostState() {
307 if (host()) { 313 if (host()) {
308 host()->SetTotalBytes(size_); 314 host()->SetTotalBytes(size_);
309 host()->SetBufferedBytes(size_); 315 host()->SetBufferedBytes(size_);
310 } 316 }
311 } 317 }
312 318
313 } // namespace webkit_media 319 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/simple_data_source.h ('k') | webkit/media/simple_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698