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

Side by Side Diff: content/common/resource_messages.cc

Issue 1108083002: Create blobs from Disk Cache entries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: omg, fix the correct base::Unretained... Created 5 years, 6 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 "content/common/resource_messages.h" 5 #include "content/common/resource_messages.h"
6 6
7 #include "net/base/load_timing_info.h" 7 #include "net/base/load_timing_info.h"
8 #include "net/http/http_response_headers.h" 8 #include "net/http/http_response_headers.h"
9 9
10 namespace IPC { 10 namespace IPC {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 WriteParam(m, p.expected_modification_time()); 49 WriteParam(m, p.expected_modification_time());
50 break; 50 break;
51 } 51 }
52 case storage::DataElement::TYPE_FILE_FILESYSTEM: { 52 case storage::DataElement::TYPE_FILE_FILESYSTEM: {
53 WriteParam(m, p.filesystem_url()); 53 WriteParam(m, p.filesystem_url());
54 WriteParam(m, p.offset()); 54 WriteParam(m, p.offset());
55 WriteParam(m, p.length()); 55 WriteParam(m, p.length());
56 WriteParam(m, p.expected_modification_time()); 56 WriteParam(m, p.expected_modification_time());
57 break; 57 break;
58 } 58 }
59 default: { 59 case storage::DataElement::TYPE_BLOB: {
60 DCHECK(p.type() == storage::DataElement::TYPE_BLOB);
61 WriteParam(m, p.blob_uuid()); 60 WriteParam(m, p.blob_uuid());
62 WriteParam(m, p.offset()); 61 WriteParam(m, p.offset());
63 WriteParam(m, p.length()); 62 WriteParam(m, p.length());
64 break; 63 break;
65 } 64 }
65 case storage::DataElement::TYPE_DISK_CACHE_ENTRY: {
66 NOTREACHED() << "Can't be sent by IPC.";
67 break;
68 }
69 case storage::DataElement::TYPE_UNKNOWN: {
70 NOTREACHED();
71 break;
72 }
66 } 73 }
67 } 74 }
68 75
69 bool ParamTraits<storage::DataElement>::Read(const Message* m, 76 bool ParamTraits<storage::DataElement>::Read(const Message* m,
70 base::PickleIterator* iter, 77 base::PickleIterator* iter,
71 param_type* r) { 78 param_type* r) {
72 int type; 79 int type;
73 if (!ReadParam(m, iter, &type)) 80 if (!ReadParam(m, iter, &type))
74 return false; 81 return false;
75 switch (type) { 82 switch (type) {
(...skipping 30 matching lines...) Expand all
106 if (!ReadParam(m, iter, &offset)) 113 if (!ReadParam(m, iter, &offset))
107 return false; 114 return false;
108 if (!ReadParam(m, iter, &length)) 115 if (!ReadParam(m, iter, &length))
109 return false; 116 return false;
110 if (!ReadParam(m, iter, &expected_modification_time)) 117 if (!ReadParam(m, iter, &expected_modification_time))
111 return false; 118 return false;
112 r->SetToFileSystemUrlRange(file_system_url, offset, length, 119 r->SetToFileSystemUrlRange(file_system_url, offset, length,
113 expected_modification_time); 120 expected_modification_time);
114 break; 121 break;
115 } 122 }
116 default: { 123 case storage::DataElement::TYPE_BLOB: {
117 DCHECK(type == storage::DataElement::TYPE_BLOB);
118 std::string blob_uuid; 124 std::string blob_uuid;
119 uint64 offset, length; 125 uint64 offset, length;
120 if (!ReadParam(m, iter, &blob_uuid)) 126 if (!ReadParam(m, iter, &blob_uuid))
121 return false; 127 return false;
122 if (!ReadParam(m, iter, &offset)) 128 if (!ReadParam(m, iter, &offset))
123 return false; 129 return false;
124 if (!ReadParam(m, iter, &length)) 130 if (!ReadParam(m, iter, &length))
125 return false; 131 return false;
126 r->SetToBlobRange(blob_uuid, offset, length); 132 r->SetToBlobRange(blob_uuid, offset, length);
127 break; 133 break;
128 } 134 }
135 case storage::DataElement::TYPE_DISK_CACHE_ENTRY: {
136 NOTREACHED() << "Can't be sent by IPC.";
137 break;
138 }
139 case storage::DataElement::TYPE_UNKNOWN: {
140 NOTREACHED();
141 break;
142 }
129 } 143 }
130 return true; 144 return true;
131 } 145 }
132 146
133 void ParamTraits<storage::DataElement>::Log(const param_type& p, 147 void ParamTraits<storage::DataElement>::Log(const param_type& p,
134 std::string* l) { 148 std::string* l) {
135 l->append("<storage::DataElement>"); 149 l->append("<storage::DataElement>");
136 } 150 }
137 151
138 void ParamTraits<scoped_refptr<content::ResourceDevToolsInfo> >::Write( 152 void ParamTraits<scoped_refptr<content::ResourceDevToolsInfo> >::Write(
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 (*r)->set_identifier(identifier); 307 (*r)->set_identifier(identifier);
294 return true; 308 return true;
295 } 309 }
296 310
297 void ParamTraits<scoped_refptr<content::ResourceRequestBody> >::Log( 311 void ParamTraits<scoped_refptr<content::ResourceRequestBody> >::Log(
298 const param_type& p, std::string* l) { 312 const param_type& p, std::string* l) {
299 l->append("<ResourceRequestBody>"); 313 l->append("<ResourceRequestBody>");
300 } 314 }
301 315
302 } // namespace IPC 316 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698