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

Unified Diff: chrome/browser/android/tab_state.cc

Issue 1154283003: Change most uses of Pickle to base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/tab_state.cc
diff --git a/chrome/browser/android/tab_state.cc b/chrome/browser/android/tab_state.cc
index 5e01566491aedfdac4cbd9d44756bee0e7dc70e1..f22255a88318a8fccf0ab1da28a9ce17309fd508 100644
--- a/chrome/browser/android/tab_state.cc
+++ b/chrome/browser/android/tab_state.cc
@@ -33,8 +33,10 @@ using content::WebContents;
namespace {
-bool WriteStateHeaderToPickle(bool off_the_record, int entry_count,
- int current_entry_index, Pickle* pickle) {
+bool WriteStateHeaderToPickle(bool off_the_record,
+ int entry_count,
+ int current_entry_index,
+ base::Pickle* pickle) {
return pickle->WriteBool(off_the_record) &&
pickle->WriteInt(entry_count) &&
pickle->WriteInt(current_entry_index);
@@ -66,10 +68,9 @@ bool WriteStateHeaderToPickle(bool off_the_record, int entry_count,
void UpgradeNavigationFromV0ToV2(
std::vector<sessions::SerializedNavigationEntry>* navigations,
int entry_count,
- PickleIterator* iterator) {
-
+ base::PickleIterator* iterator) {
for (int i = 0; i < entry_count; ++i) {
- Pickle v2_pickle;
+ base::Pickle v2_pickle;
std::string virtual_url_spec;
std::string str_referrer;
base::string16 title;
@@ -104,7 +105,7 @@ void UpgradeNavigationFromV0ToV2(
// search_terms
v2_pickle.WriteString16(base::string16());
- PickleIterator tab_navigation_pickle_iterator(v2_pickle);
+ base::PickleIterator tab_navigation_pickle_iterator(v2_pickle);
sessions::SerializedNavigationEntry nav;
if (nav.ReadFromPickle(&tab_navigation_pickle_iterator)) {
navigations->push_back(nav);
@@ -152,9 +153,9 @@ void UpgradeNavigationFromV0ToV2(
void UpgradeNavigationFromV1ToV2(
std::vector<sessions::SerializedNavigationEntry>* navigations,
int entry_count,
- PickleIterator* iterator) {
+ base::PickleIterator* iterator) {
for (int i = 0; i < entry_count; ++i) {
- Pickle v2_pickle;
+ base::Pickle v2_pickle;
int index;
std::string virtual_url_spec;
@@ -203,7 +204,7 @@ void UpgradeNavigationFromV1ToV2(
// Force output of search_terms
v2_pickle.WriteString16(base::string16());
- PickleIterator tab_navigation_pickle_iterator(v2_pickle);
+ base::PickleIterator tab_navigation_pickle_iterator(v2_pickle);
sessions::SerializedNavigationEntry nav;
if (nav.ReadFromPickle(&tab_navigation_pickle_iterator)) {
navigations->push_back(nav);
@@ -224,8 +225,8 @@ bool ExtractNavigationEntries(
int* current_entry_index,
std::vector<sessions::SerializedNavigationEntry>* navigations) {
int entry_count;
- Pickle pickle(static_cast<char*>(data), size);
- PickleIterator iter(pickle);
+ base::Pickle pickle(static_cast<char*>(data), size);
+ base::PickleIterator iter(pickle);
if (!iter.ReadBool(is_off_the_record) || !iter.ReadInt(&entry_count) ||
!iter.ReadInt(current_entry_index)) {
LOG(ERROR) << "Failed to restore state from byte array (length=" << size
@@ -258,9 +259,10 @@ bool ExtractNavigationEntries(
<< ").";
return false; // It's dangerous to keep deserializing now, give up.
}
- Pickle tab_navigation_pickle(tab_navigation_data,
- tab_navigation_data_length);
- PickleIterator tab_navigation_pickle_iterator(tab_navigation_pickle);
+ base::Pickle tab_navigation_pickle(tab_navigation_data,
+ tab_navigation_data_length);
+ base::PickleIterator tab_navigation_pickle_iterator(
+ tab_navigation_pickle);
sessions::SerializedNavigationEntry nav;
if (!nav.ReadFromPickle(&tab_navigation_pickle_iterator))
return false; // If we failed to read a navigation, give up on others.
@@ -321,7 +323,7 @@ ScopedJavaLocalRef<jobject> WebContentsState::WriteNavigationsAsByteBuffer(
bool is_off_the_record,
const std::vector<content::NavigationEntry*>& navigations,
int current_entry) {
- Pickle pickle;
+ base::Pickle pickle;
if (!WriteStateHeaderToPickle(is_off_the_record, navigations.size(),
current_entry, &pickle)) {
LOG(ERROR) << "Failed to serialize tab state (entry count=" <<
@@ -333,7 +335,7 @@ ScopedJavaLocalRef<jobject> WebContentsState::WriteNavigationsAsByteBuffer(
for (size_t i = 0; i < navigations.size(); ++i) {
// Write each SerializedNavigationEntry as a separate pickle to avoid
// optional reads of one tab bleeding into the next tab's data.
- Pickle tab_navigation_pickle;
+ base::Pickle tab_navigation_pickle;
// Max size taken from BaseSessionService::CreateUpdateTabNavigationCommand.
static const size_t max_state_size =
std::numeric_limits<sessions::SessionCommand::size_type>::max() - 1024;

Powered by Google App Engine
This is Rietveld 408576698