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

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

Issue 2832021: Remove preprocess hack now that WebKit has been updated.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2010 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"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // 5: Adds support for empty FormData 54 // 5: Adds support for empty FormData
55 // 6: Adds support for documentSequenceNumbers 55 // 6: Adds support for documentSequenceNumbers
56 // 7: Adds support for stateObject 56 // 7: Adds support for stateObject
57 // 8: Adds support for file range and modification time 57 // 8: Adds support for file range and modification time
58 // 9: Adds support for itemSequenceNumbers 58 // 9: Adds support for itemSequenceNumbers
59 // Should be const, but unit tests may modify it. 59 // Should be const, but unit tests may modify it.
60 // 60 //
61 // NOTE: If the version is -1, then the pickle contains only a URL string. 61 // NOTE: If the version is -1, then the pickle contains only a URL string.
62 // See CreateHistoryStateForURL. 62 // See CreateHistoryStateForURL.
63 // 63 //
64 #if defined(WEBKIT_BUG_40451_IS_FIXED)
65 int kVersion = 9; 64 int kVersion = 9;
66 #else
67 int kVersion = 8;
68 #endif
69 65
70 // A bunch of convenience functions to read/write to SerializeObjects. 66 // A bunch of convenience functions to read/write to SerializeObjects.
71 // The serializers assume the input data is in the correct format and so does 67 // The serializers assume the input data is in the correct format and so does
72 // no error checking. 68 // no error checking.
73 inline void WriteData(const void* data, int length, SerializeObject* obj) { 69 inline void WriteData(const void* data, int length, SerializeObject* obj) {
74 obj->pickle.WriteData(static_cast<const char*>(data), length); 70 obj->pickle.WriteData(static_cast<const char*>(data), length);
75 } 71 }
76 72
77 inline void ReadData(const SerializeObject* obj, const void** data, 73 inline void ReadData(const SerializeObject* obj, const void** data,
78 int* length) { 74 int* length) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 WriteString(item.alternateTitle(), obj); 300 WriteString(item.alternateTitle(), obj);
305 WriteReal(item.lastVisitedTime(), obj); 301 WriteReal(item.lastVisitedTime(), obj);
306 WriteInteger(item.scrollOffset().x, obj); 302 WriteInteger(item.scrollOffset().x, obj);
307 WriteInteger(item.scrollOffset().y, obj); 303 WriteInteger(item.scrollOffset().y, obj);
308 WriteBoolean(item.isTargetItem(), obj); 304 WriteBoolean(item.isTargetItem(), obj);
309 WriteInteger(item.visitCount(), obj); 305 WriteInteger(item.visitCount(), obj);
310 WriteString(item.referrer(), obj); 306 WriteString(item.referrer(), obj);
311 307
312 WriteStringVector(item.documentState(), obj); 308 WriteStringVector(item.documentState(), obj);
313 309
314 #if defined(WEBKIT_BUG_40451_IS_FIXED)
315 if (kVersion >= 9) 310 if (kVersion >= 9)
316 WriteInteger64(item.itemSequenceNumber(), obj); 311 WriteInteger64(item.itemSequenceNumber(), obj);
317 #endif
318 if (kVersion >= 6) 312 if (kVersion >= 6)
319 WriteInteger64(item.documentSequenceNumber(), obj); 313 WriteInteger64(item.documentSequenceNumber(), obj);
320 if (kVersion >= 7) { 314 if (kVersion >= 7) {
321 bool has_state_object = !item.stateObject().isNull(); 315 bool has_state_object = !item.stateObject().isNull();
322 WriteBoolean(has_state_object, obj); 316 WriteBoolean(has_state_object, obj);
323 if (has_state_object) 317 if (has_state_object)
324 WriteString(item.stateObject().toString(), obj); 318 WriteString(item.stateObject().toString(), obj);
325 } 319 }
326 320
327 // Yes, the referrer is written twice. This is for backwards 321 // Yes, the referrer is written twice. This is for backwards
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 item.setLastVisitedTime(ReadReal(obj)); 361 item.setLastVisitedTime(ReadReal(obj));
368 int x = ReadInteger(obj); 362 int x = ReadInteger(obj);
369 int y = ReadInteger(obj); 363 int y = ReadInteger(obj);
370 item.setScrollOffset(WebPoint(x, y)); 364 item.setScrollOffset(WebPoint(x, y));
371 item.setIsTargetItem(ReadBoolean(obj)); 365 item.setIsTargetItem(ReadBoolean(obj));
372 item.setVisitCount(ReadInteger(obj)); 366 item.setVisitCount(ReadInteger(obj));
373 item.setReferrer(ReadString(obj)); 367 item.setReferrer(ReadString(obj));
374 368
375 item.setDocumentState(ReadStringVector(obj)); 369 item.setDocumentState(ReadStringVector(obj));
376 370
377 #if defined(WEBKIT_BUG_40451_IS_FIXED)
378 if (obj->version >= 9) 371 if (obj->version >= 9)
379 item.setItemSequenceNumber(ReadInteger64(obj)); 372 item.setItemSequenceNumber(ReadInteger64(obj));
380 #endif
381 if (obj->version >= 6) 373 if (obj->version >= 6)
382 item.setDocumentSequenceNumber(ReadInteger64(obj)); 374 item.setDocumentSequenceNumber(ReadInteger64(obj));
383 if (obj->version >= 7) { 375 if (obj->version >= 7) {
384 bool has_state_object = ReadBoolean(obj); 376 bool has_state_object = ReadBoolean(obj);
385 if (has_state_object) { 377 if (has_state_object) {
386 item.setStateObject( 378 item.setStateObject(
387 WebSerializedScriptValue::fromString(ReadString(obj))); 379 WebSerializedScriptValue::fromString(ReadString(obj)));
388 } 380 }
389 } 381 }
390 382
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 const WebHistoryItem& item = HistoryItemFromString(content_state, false); 464 const WebHistoryItem& item = HistoryItemFromString(content_state, false);
473 if (item.isNull()) { 465 if (item.isNull()) {
474 // Couldn't parse the string, return an empty string. 466 // Couldn't parse the string, return an empty string.
475 return std::string(); 467 return std::string();
476 } 468 }
477 469
478 return HistoryItemToString(item); 470 return HistoryItemToString(item);
479 } 471 }
480 472
481 } // namespace webkit_glue 473 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698