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

Unified Diff: ios/web/web_state/web_state_impl.mm

Issue 1361173005: Created SerializedUserDataManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@serialized_navigation_manager
Patch Set: Eugene's comments Created 5 years, 3 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: ios/web/web_state/web_state_impl.mm
diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm
index 17e4a547e043d5033101724aa4243cfe295b844e..07e59a926b5085fb9c17ad1f86cbde7fdacc6b13 100644
--- a/ios/web/web_state/web_state_impl.mm
+++ b/ios/web/web_state/web_state_impl.mm
@@ -12,6 +12,7 @@
#include "ios/web/net/request_group_util.h"
#include "ios/web/public/browser_state.h"
#include "ios/web/public/navigation_item.h"
+#include "ios/web/public/serialized_user_data_manager.h"
#include "ios/web/public/url_util.h"
#include "ios/web/public/web_client.h"
#include "ios/web/public/web_state/credential.h"
@@ -107,8 +108,19 @@ void WebStateImpl::SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate) {
}
scoped_ptr<WebStateImpl> WebStateImpl::CopyForSerialization() const {
- return scoped_ptr<WebStateImpl>(new WebStateImpl(
+ scoped_ptr<WebStateImpl> copy(new WebStateImpl(
GetBrowserState(), navigation_manager_->CopyForSerialization()));
+ // Copy the serialized user data and detach the user data thread so the newly
+ // created WebState can be serialized on another thread.
+ WebStateImpl* non_const_this = const_cast<WebStateImpl*>(this);
Eugene But (OOO till 7-30) 2015/09/24 21:39:25 This is a violation of API contract. This method p
+ SerializedUserDataManager* user_data_manager =
+ SerializedUserDataManager::FromWebState(non_const_this);
+ SerializedUserDataManager* copy_user_data_manager =
+ SerializedUserDataManager::FromWebState(copy.get());
+ copy_user_data_manager->AddValuesFromDictionary(
+ user_data_manager->GetSerializationDictionary());
+ copy->DetachUserDataThread();
+ return copy.Pass();
}
void WebStateImpl::OnUrlHashChanged() {

Powered by Google App Engine
This is Rietveld 408576698