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

Side by Side Diff: content/browser/download/download_resource_handler.cc

Issue 22925003: Explain the reason why we don't have thread check in destructor of ByteStreamReader/WriterImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 9 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 | « content/browser/byte_stream.cc ('k') | no next file » | 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 "content/browser/download/download_resource_handler.h" 5 #include "content/browser/download/download_resource_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 scoped_ptr<ByteStreamReader> stream, 52 scoped_ptr<ByteStreamReader> stream,
53 const DownloadUrlParameters::OnStartedCallback& started_cb) { 53 const DownloadUrlParameters::OnStartedCallback& started_cb) {
54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
55 55
56 DownloadManager* download_manager = info->request_handle.GetDownloadManager(); 56 DownloadManager* download_manager = info->request_handle.GetDownloadManager();
57 if (!download_manager) { 57 if (!download_manager) {
58 // NULL in unittests or if the page closed right after starting the 58 // NULL in unittests or if the page closed right after starting the
59 // download. 59 // download.
60 if (!started_cb.is_null()) 60 if (!started_cb.is_null())
61 started_cb.Run(NULL, DOWNLOAD_INTERRUPT_REASON_USER_CANCELED); 61 started_cb.Run(NULL, DOWNLOAD_INTERRUPT_REASON_USER_CANCELED);
62
63 // |stream| gets deleted on non-FILE thread, but it's ok since
64 // we're not using stream_writer_ yet.
65
62 return; 66 return;
63 } 67 }
64 68
65 download_manager->StartDownload(info.Pass(), stream.Pass(), started_cb); 69 download_manager->StartDownload(info.Pass(), stream.Pass(), started_cb);
66 } 70 }
67 71
68 } // namespace 72 } // namespace
69 73
70 const int DownloadResourceHandler::kDownloadByteStreamSize = 100 * 1024; 74 const int DownloadResourceHandler::kDownloadByteStreamSize = 100 * 1024;
71 75
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 480
477 // Remove output stream callback if a stream exists. 481 // Remove output stream callback if a stream exists.
478 if (stream_writer_) 482 if (stream_writer_)
479 stream_writer_->RegisterCallback(base::Closure()); 483 stream_writer_->RegisterCallback(base::Closure());
480 484
481 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", 485 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration",
482 base::TimeTicks::Now() - download_start_time_); 486 base::TimeTicks::Now() - download_start_time_);
483 } 487 }
484 488
485 } // namespace content 489 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/byte_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698