Commit fe785bc5 authored by Jan Krcal's avatar Jan Krcal Committed by Commit Bot

[protobuf] Convert document_tab_model_info from nano to lite

Bug: 782237
Change-Id: Id89fbfdd30c769fc1dc272d81b1a2fffdb7903fd
Reviewed-on: https://chromium-review.googlesource.com/809017Reviewed-by: default avatarTommy Nyquist <nyquist@chromium.org>
Commit-Queue: Jan Krcal <jkrcal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543318}
parent 65ae1de2
...@@ -400,6 +400,7 @@ proto_java_library("document_tab_model_info_proto_java") { ...@@ -400,6 +400,7 @@ proto_java_library("document_tab_model_info_proto_java") {
sources = [ sources = [
"$proto_path/document_tab_model_info.proto", "$proto_path/document_tab_model_info.proto",
] ]
generate_lite = true
} }
proto_java_library("partner_location_descriptor_proto_java") { proto_java_library("partner_location_descriptor_proto_java") {
......
...@@ -8,8 +8,6 @@ import android.content.Context; ...@@ -8,8 +8,6 @@ import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.util.SparseArray; import android.util.SparseArray;
import com.google.protobuf.nano.MessageNano;
import org.chromium.base.ContextUtils; import org.chromium.base.ContextUtils;
import org.chromium.base.Log; import org.chromium.base.Log;
import org.chromium.base.StreamUtil; import org.chromium.base.StreamUtil;
...@@ -169,15 +167,15 @@ public class StorageDelegate extends TabPersister { ...@@ -169,15 +167,15 @@ public class StorageDelegate extends TabPersister {
if (metadataBytes != null) { if (metadataBytes != null) {
DocumentList list = null; DocumentList list = null;
try { try {
list = MessageNano.mergeFrom(new DocumentList(), metadataBytes); list = DocumentList.parseFrom(metadataBytes);
} catch (IOException e) { } catch (IOException e) {
Log.e(TAG, "I/O exception", e); Log.e(TAG, "I/O exception", e);
} }
if (list == null) return; if (list == null) return;
for (int i = 0; i < list.entries.length; i++) { for (int i = 0; i < list.getEntriesCount(); i++) {
DocumentEntry savedEntry = list.entries[i]; DocumentEntry savedEntry = list.getEntries(i);
int tabId = savedEntry.tabId; int tabId = savedEntry.getTabId();
// If the tab ID isn't in the list, it must have been closed after Chrome died. // If the tab ID isn't in the list, it must have been closed after Chrome died.
if (entryMap.indexOfKey(tabId) < 0) { if (entryMap.indexOfKey(tabId) < 0) {
...@@ -186,7 +184,7 @@ public class StorageDelegate extends TabPersister { ...@@ -186,7 +184,7 @@ public class StorageDelegate extends TabPersister {
} }
// Restore information about the Tab. // Restore information about the Tab.
entryMap.get(tabId).canGoBack = savedEntry.canGoBack; entryMap.get(tabId).canGoBack = savedEntry.getCanGoBack();
} }
} }
} }
......
...@@ -11,6 +11,9 @@ package org.chromium.chrome.browser.tabmodel.document; ...@@ -11,6 +11,9 @@ package org.chromium.chrome.browser.tabmodel.document;
option java_outer_classname = "DocumentTabModelInfo"; option java_outer_classname = "DocumentTabModelInfo";
option java_package = "org.chromium.chrome.browser.tabmodel.document"; option java_package = "org.chromium.chrome.browser.tabmodel.document";
// TODO(jkrcal): Remove when protobuf 4.0 is out, https://crbug.com/800281.
option optimize_for = LITE_RUNTIME;
message DocumentEntry { message DocumentEntry {
// Next ID to use: 7 // Next ID to use: 7
optional bool can_go_back = 4; optional bool can_go_back = 4;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment