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

Side by Side Diff: webkit/glue/glue_serialize.cc

Issue 556055: Update webkit to r53957.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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
« no previous file with comments | « DEPS ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/glue/glue_serialize.h" 5 #include "webkit/glue/glue_serialize.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
(...skipping 30 matching lines...) Expand all
42 42
43 // TODO(mpcomplete): obsolete versions 1 and 2 after 1/1/2008. 43 // TODO(mpcomplete): obsolete versions 1 and 2 after 1/1/2008.
44 // Version ID used in reading/writing history items. 44 // Version ID used in reading/writing history items.
45 // 1: Initial revision. 45 // 1: Initial revision.
46 // 2: Added case for NULL string versus "". Version 2 code can read Version 1 46 // 2: Added case for NULL string versus "". Version 2 code can read Version 1
47 // data, but not vice versa. 47 // data, but not vice versa.
48 // 3: Version 2 was broken, it stored number of WebUChars, not number of bytes. 48 // 3: Version 2 was broken, it stored number of WebUChars, not number of bytes.
49 // This version checks and reads v1 and v2 correctly. 49 // This version checks and reads v1 and v2 correctly.
50 // 4: Adds support for storing FormData::identifier(). 50 // 4: Adds support for storing FormData::identifier().
51 // 5: Adds support for empty FormData 51 // 5: Adds support for empty FormData
52 // 6: Adds support for documentSequenceNumbers
52 // Should be const, but unit tests may modify it. 53 // Should be const, but unit tests may modify it.
53 int kVersion = 5; 54 int kVersion = 6;
54 55
55 // A bunch of convenience functions to read/write to SerializeObjects. 56 // A bunch of convenience functions to read/write to SerializeObjects.
56 // The serializers assume the input data is in the correct format and so does 57 // The serializers assume the input data is in the correct format and so does
57 // no error checking. 58 // no error checking.
58 inline void WriteData(const void* data, int length, SerializeObject* obj) { 59 inline void WriteData(const void* data, int length, SerializeObject* obj) {
59 obj->pickle.WriteData(static_cast<const char*>(data), length); 60 obj->pickle.WriteData(static_cast<const char*>(data), length);
60 } 61 }
61 62
62 inline void ReadData(const SerializeObject* obj, const void** data, 63 inline void ReadData(const SerializeObject* obj, const void** data,
63 int* length) { 64 int* length) {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 WriteString(item.alternateTitle(), obj); 267 WriteString(item.alternateTitle(), obj);
267 WriteReal(item.lastVisitedTime(), obj); 268 WriteReal(item.lastVisitedTime(), obj);
268 WriteInteger(item.scrollOffset().x, obj); 269 WriteInteger(item.scrollOffset().x, obj);
269 WriteInteger(item.scrollOffset().y, obj); 270 WriteInteger(item.scrollOffset().y, obj);
270 WriteBoolean(item.isTargetItem(), obj); 271 WriteBoolean(item.isTargetItem(), obj);
271 WriteInteger(item.visitCount(), obj); 272 WriteInteger(item.visitCount(), obj);
272 WriteString(item.referrer(), obj); 273 WriteString(item.referrer(), obj);
273 274
274 WriteStringVector(item.documentState(), obj); 275 WriteStringVector(item.documentState(), obj);
275 276
277 WriteInteger64(item.documentSequenceNumber(), obj);
278
276 // Yes, the referrer is written twice. This is for backwards 279 // Yes, the referrer is written twice. This is for backwards
277 // compatibility with the format. 280 // compatibility with the format.
278 WriteFormData(item.httpBody(), obj); 281 WriteFormData(item.httpBody(), obj);
279 WriteString(item.httpContentType(), obj); 282 WriteString(item.httpContentType(), obj);
280 WriteString(item.referrer(), obj); 283 WriteString(item.referrer(), obj);
281 284
282 // Subitems 285 // Subitems
283 const WebVector<WebHistoryItem>& children = item.children(); 286 const WebVector<WebHistoryItem>& children = item.children();
284 WriteInteger(static_cast<int>(children.size()), obj); 287 WriteInteger(static_cast<int>(children.size()), obj);
285 for (size_t i = 0, c = children.size(); i < c; ++i) 288 for (size_t i = 0, c = children.size(); i < c; ++i)
(...skipping 22 matching lines...) Expand all
308 item.setLastVisitedTime(ReadReal(obj)); 311 item.setLastVisitedTime(ReadReal(obj));
309 int x = ReadInteger(obj); 312 int x = ReadInteger(obj);
310 int y = ReadInteger(obj); 313 int y = ReadInteger(obj);
311 item.setScrollOffset(WebPoint(x, y)); 314 item.setScrollOffset(WebPoint(x, y));
312 item.setIsTargetItem(ReadBoolean(obj)); 315 item.setIsTargetItem(ReadBoolean(obj));
313 item.setVisitCount(ReadInteger(obj)); 316 item.setVisitCount(ReadInteger(obj));
314 item.setReferrer(ReadString(obj)); 317 item.setReferrer(ReadString(obj));
315 318
316 item.setDocumentState(ReadStringVector(obj)); 319 item.setDocumentState(ReadStringVector(obj));
317 320
321 if (obj->version >= 6)
322 item.setDocumentSequenceNumber(ReadInteger64(obj));
323
318 // The extra referrer string is read for backwards compat. 324 // The extra referrer string is read for backwards compat.
319 const WebHTTPBody& http_body = ReadFormData(obj); 325 const WebHTTPBody& http_body = ReadFormData(obj);
320 const WebString& http_content_type = ReadString(obj); 326 const WebString& http_content_type = ReadString(obj);
321 ALLOW_UNUSED const WebString& unused_referrer = ReadString(obj); 327 ALLOW_UNUSED const WebString& unused_referrer = ReadString(obj);
322 if (include_form_data) { 328 if (include_form_data) {
323 item.setHTTPBody(http_body); 329 item.setHTTPBody(http_body);
324 item.setHTTPContentType(http_content_type); 330 item.setHTTPContentType(http_content_type);
325 } 331 }
326 332
327 // Subitems 333 // Subitems
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 const WebHistoryItem& item = HistoryItemFromString(content_state, false); 399 const WebHistoryItem& item = HistoryItemFromString(content_state, false);
394 if (item.isNull()) { 400 if (item.isNull()) {
395 // Couldn't parse the string, return an empty string. 401 // Couldn't parse the string, return an empty string.
396 return std::string(); 402 return std::string();
397 } 403 }
398 404
399 return HistoryItemToString(item); 405 return HistoryItemToString(item);
400 } 406 }
401 407
402 } // namespace webkit_glue 408 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « DEPS ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698