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

Side by Side Diff: chrome/browser/download/download_request_handle.cc

Issue 7294013: Modified cancel and interrupt processing to avoid race with history. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/download/download_request_handle.h" 5 #include "chrome/browser/download/download_request_handle.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/tab_contents/tab_util.h" 9 #include "chrome/browser/tab_contents/tab_util.h"
10 #include "content/browser/browser_thread.h" 10 #include "content/browser/browser_thread.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 if (!contents) 61 if (!contents)
62 return NULL; 62 return NULL;
63 63
64 Profile* profile = contents->profile(); 64 Profile* profile = contents->profile();
65 if (!profile) 65 if (!profile)
66 return NULL; 66 return NULL;
67 67
68 return profile->GetDownloadManager(); 68 return profile->GetDownloadManager();
69 } 69 }
70 70
71 void DownloadRequestHandle::PauseRequest() { 71 void DownloadRequestHandle::PauseRequest() const {
72 // The post is safe because ResourceDispatcherHost is guaranteed 72 // The post is safe because ResourceDispatcherHost is guaranteed
73 // to outlive the IO thread. 73 // to outlive the IO thread.
74 if (rdh_) { 74 if (rdh_) {
75 BrowserThread::PostTask( 75 BrowserThread::PostTask(
76 BrowserThread::IO, FROM_HERE, 76 BrowserThread::IO, FROM_HERE,
77 NewRunnableFunction(&ResourceDispatcherHostPauseRequest, 77 NewRunnableFunction(&ResourceDispatcherHostPauseRequest,
78 rdh_, child_id_, request_id_, true)); 78 rdh_, child_id_, request_id_, true));
79 } 79 }
80 } 80 }
81 81
82 void DownloadRequestHandle::ResumeRequest() { 82 void DownloadRequestHandle::ResumeRequest() const {
83 // The post is safe because ResourceDispatcherHost is guaranteed 83 // The post is safe because ResourceDispatcherHost is guaranteed
84 // to outlive the IO thread. 84 // to outlive the IO thread.
85 if (rdh_) { 85 if (rdh_) {
86 BrowserThread::PostTask( 86 BrowserThread::PostTask(
87 BrowserThread::IO, FROM_HERE, 87 BrowserThread::IO, FROM_HERE,
88 NewRunnableFunction(&ResourceDispatcherHostPauseRequest, 88 NewRunnableFunction(&ResourceDispatcherHostPauseRequest,
89 rdh_, child_id_, request_id_, false)); 89 rdh_, child_id_, request_id_, false));
90 } 90 }
91 } 91 }
92 92
93 void DownloadRequestHandle::CancelRequest() { 93 void DownloadRequestHandle::CancelRequest() const {
94 // The post is safe because ResourceDispatcherHost is guaranteed 94 // The post is safe because ResourceDispatcherHost is guaranteed
95 // to outlive the IO thread. 95 // to outlive the IO thread.
96 if (rdh_) { 96 if (rdh_) {
97 BrowserThread::PostTask( 97 BrowserThread::PostTask(
98 BrowserThread::IO, FROM_HERE, 98 BrowserThread::IO, FROM_HERE,
99 NewRunnableFunction(&ResourceDispatcherHostCancelRequest, 99 NewRunnableFunction(&ResourceDispatcherHostCancelRequest,
100 rdh_, child_id_, request_id_)); 100 rdh_, child_id_, request_id_));
101 } 101 }
102 } 102 }
103 103
104 std::string DownloadRequestHandle::DebugString() const { 104 std::string DownloadRequestHandle::DebugString() const {
105 return base::StringPrintf("{" 105 return base::StringPrintf("{"
106 " child_id = %d" 106 " child_id = %d"
107 " render_view_id = %d" 107 " render_view_id = %d"
108 " request_id = %d" 108 " request_id = %d"
109 "}", 109 "}",
110 child_id_, 110 child_id_,
111 render_view_id_, 111 render_view_id_,
112 request_id_); 112 request_id_);
113 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698