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

Side by Side Diff: chrome/common/resource_dispatcher.cc

Issue 52040: Chrome changes to support cached form submissions.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "chrome/common/resource_dispatcher.h" 7 #include "chrome/common/resource_dispatcher.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 int origin_pid, 54 int origin_pid,
55 ResourceType::Type resource_type, 55 ResourceType::Type resource_type,
56 uint32 request_context, 56 uint32 request_context,
57 int route_id); 57 int route_id);
58 virtual ~IPCResourceLoaderBridge(); 58 virtual ~IPCResourceLoaderBridge();
59 59
60 // ResourceLoaderBridge 60 // ResourceLoaderBridge
61 virtual void AppendDataToUpload(const char* data, int data_len); 61 virtual void AppendDataToUpload(const char* data, int data_len);
62 virtual void AppendFileRangeToUpload(const std::wstring& path, 62 virtual void AppendFileRangeToUpload(const std::wstring& path,
63 uint64 offset, uint64 length); 63 uint64 offset, uint64 length);
64 virtual void SetUploadIdentifier(int64 identifier);
64 virtual bool Start(Peer* peer); 65 virtual bool Start(Peer* peer);
65 virtual void Cancel(); 66 virtual void Cancel();
66 virtual void SetDefersLoading(bool value); 67 virtual void SetDefersLoading(bool value);
67 virtual void SyncLoad(SyncLoadResponse* response); 68 virtual void SyncLoad(SyncLoadResponse* response);
68 69
69 #ifdef LOG_RESOURCE_REQUESTS 70 #ifdef LOG_RESOURCE_REQUESTS
70 const std::string& url() const { return url_; } 71 const std::string& url() const { return url_; }
71 #endif 72 #endif
72 73
73 private: 74 private:
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 141 }
141 142
142 void IPCResourceLoaderBridge::AppendDataToUpload(const char* data, 143 void IPCResourceLoaderBridge::AppendDataToUpload(const char* data,
143 int data_len) { 144 int data_len) {
144 DCHECK(request_id_ == -1) << "request already started"; 145 DCHECK(request_id_ == -1) << "request already started";
145 146
146 // don't bother appending empty data segments 147 // don't bother appending empty data segments
147 if (data_len == 0) 148 if (data_len == 0)
148 return; 149 return;
149 150
150 request_.upload_content.push_back(net::UploadData::Element()); 151 if (!request_.upload_data)
151 request_.upload_content.back().SetToBytes(data, data_len); 152 request_.upload_data = new net::UploadData();
153 request_.upload_data->AppendBytes(data, data_len);
152 } 154 }
153 155
154 void IPCResourceLoaderBridge::AppendFileRangeToUpload( 156 void IPCResourceLoaderBridge::AppendFileRangeToUpload(
155 const std::wstring& path, uint64 offset, uint64 length) { 157 const std::wstring& path, uint64 offset, uint64 length) {
156 DCHECK(request_id_ == -1) << "request already started"; 158 DCHECK(request_id_ == -1) << "request already started";
157 159
158 request_.upload_content.push_back(net::UploadData::Element()); 160 if (!request_.upload_data)
159 request_.upload_content.back().SetToFilePathRange(path, offset, length); 161 request_.upload_data = new net::UploadData();
162 request_.upload_data->AppendFileRange(path, offset, length);
163 }
164
165 void IPCResourceLoaderBridge::SetUploadIdentifier(int64 identifier) {
166 DCHECK(request_id_ == -1) << "request already started";
167
168 if (!request_.upload_data)
169 request_.upload_data = new net::UploadData();
170 request_.upload_data->set_identifier(identifier);
160 } 171 }
161 172
162 // Writes a footer on the message and sends it 173 // Writes a footer on the message and sends it
163 bool IPCResourceLoaderBridge::Start(Peer* peer) { 174 bool IPCResourceLoaderBridge::Start(Peer* peer) {
164 if (request_id_ != -1) { 175 if (request_id_ != -1) {
165 NOTREACHED() << "Starting a request twice"; 176 NOTREACHED() << "Starting a request twice";
166 return false; 177 return false;
167 } 178 }
168 179
169 RESOURCE_LOG("Starting request for " << url_); 180 RESOURCE_LOG("Starting request for " << url_);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 case ViewMsg_Resource_DataReceived::ID: 545 case ViewMsg_Resource_DataReceived::ID:
535 case ViewMsg_Resource_RequestComplete::ID: 546 case ViewMsg_Resource_RequestComplete::ID:
536 return true; 547 return true;
537 548
538 default: 549 default:
539 break; 550 break;
540 } 551 }
541 552
542 return false; 553 return false;
543 } 554 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698