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

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

Issue 148133007: [Downloads] Always call DM::StartDownload() for explicit downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 void ResumeRequest(); 90 void ResumeRequest();
91 91
92 // May result in this object being deleted by its owner. 92 // May result in this object being deleted by its owner.
93 void CancelRequest(); 93 void CancelRequest();
94 94
95 std::string DebugString() const; 95 std::string DebugString() const;
96 96
97 private: 97 private:
98 virtual ~DownloadResourceHandler(); 98 virtual ~DownloadResourceHandler();
99 99
100 // Arrange for started_cb_ to be called on the UI thread with the 100 void NotifyDownloadManagerOfSuccessfulResponseStart(
101 // below values, nulling out started_cb_. Should only be called 101 ResourceResponse* response);
102 // on the IO thread. 102
103 void CallStartedCB(DownloadItem* item, 103 void NotifyDownloadManagerOfFailedRequest(
104 DownloadInterruptReason interrupt_reason); 104 DownloadInterruptReason interrupt_reason);
105 105
106 uint32 download_id_; 106 uint32 download_id_;
107 // This is read only on the IO thread, but may only 107 // This is read only on the IO thread, but may only
108 // be called on the UI thread. 108 // be called on the UI thread.
109 DownloadUrlParameters::OnStartedCallback started_cb_; 109 DownloadUrlParameters::OnStartedCallback started_cb_;
110 scoped_ptr<DownloadSaveInfo> save_info_; 110 scoped_ptr<DownloadSaveInfo> save_info_;
111 111
112 // Data flow 112 // Data flow
113 scoped_refptr<net::IOBuffer> read_buffer_; // From URLRequest. 113 scoped_refptr<net::IOBuffer> read_buffer_; // From URLRequest.
114 scoped_ptr<ByteStreamWriter> stream_writer_; // To rest of system. 114 scoped_ptr<ByteStreamWriter> stream_writer_; // To rest of system.
115 115
116 // The following are used to collect stats. 116 // The following are used to collect stats.
117 base::TimeTicks download_start_time_; 117 base::TimeTicks download_start_time_;
118 base::TimeTicks last_read_time_; 118 base::TimeTicks last_read_time_;
119 base::TimeTicks last_stream_pause_time_; 119 base::TimeTicks last_stream_pause_time_;
120 base::TimeDelta total_pause_time_; 120 base::TimeDelta total_pause_time_;
121 size_t last_buffer_size_; 121 size_t last_buffer_size_;
122 int64 bytes_read_; 122 int64 bytes_read_;
123 123
124 int pause_count_; 124 int pause_count_;
125 bool was_deferred_; 125 bool was_deferred_;
126 126
127 // For DCHECKing 127 // For DCHECKing
128 bool on_response_started_called_; 128 bool download_manager_notified_;
129 129
130 static const int kReadBufSize = 32768; // bytes 130 static const int kReadBufSize = 32768; // bytes
131 static const int kThrottleTimeMs = 200; // milliseconds 131 static const int kThrottleTimeMs = 200; // milliseconds
132 132
133 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); 133 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler);
134 }; 134 };
135 135
136 } // namespace content 136 } // namespace content
137 137
138 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ 138 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698