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

Side by Side Diff: webkit/blob/blob_storage_controller.cc

Issue 10832003: Add const accessors to URLRequest and UploadData. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Forgot to check browser_tests Created 8 years, 4 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
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 "webkit/blob/blob_storage_controller.h" 5 #include "webkit/blob/blob_storage_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "net/base/upload_data.h" 9 #include "net/base/upload_data.h"
10 #include "webkit/blob/blob_data.h" 10 #include "webkit/blob/blob_data.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 BlobData* BlobStorageController::GetBlobDataFromUrl(const GURL& url) { 166 BlobData* BlobStorageController::GetBlobDataFromUrl(const GURL& url) {
167 BlobMap::iterator found = blob_map_.find( 167 BlobMap::iterator found = blob_map_.find(
168 BlobUrlHasRef(url) ? ClearBlobUrlRef(url).spec() : url.spec()); 168 BlobUrlHasRef(url) ? ClearBlobUrlRef(url).spec() : url.spec());
169 return (found != blob_map_.end()) ? found->second : NULL; 169 return (found != blob_map_.end()) ? found->second : NULL;
170 } 170 }
171 171
172 void BlobStorageController::ResolveBlobReferencesInUploadData( 172 void BlobStorageController::ResolveBlobReferencesInUploadData(
173 net::UploadData* upload_data) { 173 net::UploadData* upload_data) {
174 DCHECK(upload_data); 174 DCHECK(upload_data);
175 175
176 std::vector<net::UploadData::Element>* uploads = upload_data->elements(); 176 std::vector<net::UploadData::Element>* uploads =
177 upload_data->elements_mutable();
177 std::vector<net::UploadData::Element>::iterator iter; 178 std::vector<net::UploadData::Element>::iterator iter;
178 for (iter = uploads->begin(); iter != uploads->end();) { 179 for (iter = uploads->begin(); iter != uploads->end();) {
179 if (iter->type() != net::UploadData::TYPE_BLOB) { 180 if (iter->type() != net::UploadData::TYPE_BLOB) {
180 iter++; 181 iter++;
181 continue; 182 continue;
182 } 183 }
183 184
184 // Find the referred blob data. 185 // Find the referred blob data.
185 BlobData* blob_data = GetBlobDataFromUrl(iter->blob_url()); 186 BlobData* blob_data = GetBlobDataFromUrl(iter->blob_url());
186 DCHECK(blob_data); 187 DCHECK(blob_data);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 bool BlobStorageController::DecrementBlobDataUsage(BlobData* blob_data) { 294 bool BlobStorageController::DecrementBlobDataUsage(BlobData* blob_data) {
294 BlobDataUsageMap::iterator found = blob_data_usage_count_.find(blob_data); 295 BlobDataUsageMap::iterator found = blob_data_usage_count_.find(blob_data);
295 DCHECK(found != blob_data_usage_count_.end()); 296 DCHECK(found != blob_data_usage_count_.end());
296 if (--(found->second)) 297 if (--(found->second))
297 return false; // Still in use 298 return false; // Still in use
298 blob_data_usage_count_.erase(found); 299 blob_data_usage_count_.erase(found);
299 return true; 300 return true;
300 } 301 }
301 302
302 } // namespace webkit_blob 303 } // namespace webkit_blob
OLDNEW
« no previous file with comments | « net/url_request/url_request.cc ('k') | webkit/tools/test_shell/simple_resource_loader_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698