OLD | NEW |
1 // Copyright (c) 2011 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 // This file contains an implementation of the ResourceLoaderBridge class. | 5 // This file contains an implementation of the ResourceLoaderBridge class. |
6 // The class is implemented using net::URLRequest, meaning it is a "simple" | 6 // The class is implemented using net::URLRequest, meaning it is a "simple" |
7 // version that directly issues requests. The more complicated one used in the | 7 // version that directly issues requests. The more complicated one used in the |
8 // browser uses IPC. | 8 // browser uses IPC. |
9 // | 9 // |
10 // Because net::URLRequest only provides an asynchronous resource loading API, | 10 // Because net::URLRequest only provides an asynchronous resource loading API, |
11 // this file makes use of net::URLRequest from a background IO thread. Requests | 11 // this file makes use of net::URLRequest from a background IO thread. Requests |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 // The RequestProxy does most of its work on the IO thread. The Start and | 184 // The RequestProxy does most of its work on the IO thread. The Start and |
185 // Cancel methods are proxied over to the IO thread, where an net::URLRequest | 185 // Cancel methods are proxied over to the IO thread, where an net::URLRequest |
186 // object is instantiated. | 186 // object is instantiated. |
187 class RequestProxy : public net::URLRequest::Delegate, | 187 class RequestProxy : public net::URLRequest::Delegate, |
188 public base::RefCountedThreadSafe<RequestProxy> { | 188 public base::RefCountedThreadSafe<RequestProxy> { |
189 public: | 189 public: |
190 // Takes ownership of the params. | 190 // Takes ownership of the params. |
191 RequestProxy() | 191 RequestProxy() |
192 : download_to_file_(false), | 192 : download_to_file_(false), |
| 193 file_stream_(NULL), |
193 buf_(new net::IOBuffer(kDataSize)), | 194 buf_(new net::IOBuffer(kDataSize)), |
194 last_upload_position_(0) { | 195 last_upload_position_(0) { |
195 } | 196 } |
196 | 197 |
197 void DropPeer() { | 198 void DropPeer() { |
198 peer_ = NULL; | 199 peer_ = NULL; |
199 } | 200 } |
200 | 201 |
201 void Start(ResourceLoaderBridge::Peer* peer, RequestParams* params) { | 202 void Start(ResourceLoaderBridge::Peer* peer, RequestParams* params) { |
202 peer_ = peer; | 203 peer_ = peer; |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); | 1033 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); |
1033 g_file_over_http_params = new FileOverHTTPParams(file_path_template, | 1034 g_file_over_http_params = new FileOverHTTPParams(file_path_template, |
1034 http_prefix); | 1035 http_prefix); |
1035 } | 1036 } |
1036 | 1037 |
1037 // static | 1038 // static |
1038 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( | 1039 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( |
1039 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { | 1040 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { |
1040 return new ResourceLoaderBridgeImpl(request_info); | 1041 return new ResourceLoaderBridgeImpl(request_info); |
1041 } | 1042 } |
OLD | NEW |