diff options
Diffstat (limited to 'webkit/glue/glue_serialize.cc')
-rw-r--r-- | webkit/glue/glue_serialize.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/webkit/glue/glue_serialize.cc b/webkit/glue/glue_serialize.cc index 6ec5e7f..925da42 100644 --- a/webkit/glue/glue_serialize.cc +++ b/webkit/glue/glue_serialize.cc @@ -200,12 +200,12 @@ static void WriteFormData(const FormData* form_data, SerializeObject* obj) { } } -static FormData* ReadFormData(const SerializeObject* obj) { +static PassRefPtr<FormData> ReadFormData(const SerializeObject* obj) { int num_elements = ReadInteger(obj); if (num_elements == 0) return NULL; - FormData* form_data = new FormData(); + RefPtr<FormData> form_data = FormData::create(); for (int i = 0; i < num_elements; ++i) { int type = ReadInteger(obj); @@ -219,7 +219,7 @@ static FormData* ReadFormData(const SerializeObject* obj) { } } - return form_data; + return form_data.release(); } // Writes the HistoryItem data into the SerializeObject object for @@ -259,14 +259,14 @@ static void WriteHistoryItem(const HistoryItem* item, SerializeObject* obj) { // Creates a new HistoryItem tree based on the serialized string. // Assumes the data is in the format returned by WriteHistoryItem. -static HistoryItem* ReadHistoryItem(const SerializeObject* obj) { +static PassRefPtr<HistoryItem> ReadHistoryItem(const SerializeObject* obj) { // See note in WriteHistoryItem. on this. obj->version = ReadInteger(obj); if (obj->version > kVersion) return NULL; - HistoryItem* item = new HistoryItem(); + RefPtr<HistoryItem> item = HistoryItem::create(); item->setURLString(ReadString(obj)); item->setOriginalURLString(ReadString(obj)); @@ -302,7 +302,7 @@ static HistoryItem* ReadHistoryItem(const SerializeObject* obj) { for (int i = 0; i < num_children; ++i) item->addChildItem(ReadHistoryItem(obj)); - return item; + return item.release(); } // Serialize a HistoryItem to a string, using our JSON Value serializer. @@ -351,7 +351,8 @@ void HistoryItemToVersionedString(PassRefPtr<HistoryItem> item, int version, } std::string CreateHistoryStateForURL(const GURL& url) { - RefPtr<HistoryItem> item(new HistoryItem(GURLToKURL(url), String())); + // TODO(eseide): We probably should be passing a list visit time other than 0 + RefPtr<HistoryItem> item(HistoryItem::create(GURLToKURL(url), String(), 0)); std::string data; HistoryItemToString(item, &data); return data; |