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

Side by Side Diff: ios/chrome/browser/sessions/session_service.mm

Issue 2655253002: Revert of Moved NavigationManagerImpl serialization out of CRWSessionController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #import "ios/chrome/browser/sessions/session_service.h" 5 #import "ios/chrome/browser/sessions/session_service.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/mac/bind_objc_block.h" 12 #include "base/mac/bind_objc_block.h"
13 #include "base/mac/foundation_util.h" 13 #include "base/mac/foundation_util.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
16 #include "base/strings/sys_string_conversions.h" 16 #include "base/strings/sys_string_conversions.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "base/threading/sequenced_worker_pool.h" 18 #include "base/threading/sequenced_worker_pool.h"
19 #include "base/threading/thread_restrictions.h" 19 #include "base/threading/thread_restrictions.h"
20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
21 #import "ios/chrome/browser/sessions/session_window.h" 21 #import "ios/chrome/browser/sessions/session_window.h"
22 #import "ios/web/navigation/crw_session_certificate_policy_manager.h" 22 #import "ios/web/navigation/crw_session_certificate_policy_manager.h"
23 #import "ios/web/navigation/crw_session_controller.h" 23 #import "ios/web/navigation/crw_session_controller.h"
24 #import "ios/web/navigation/crw_session_entry.h" 24 #import "ios/web/navigation/crw_session_entry.h"
25 #import "ios/web/public/crw_navigation_manager_storage.h"
26 #include "ios/web/public/web_thread.h" 25 #include "ios/web/public/web_thread.h"
27 26
28 // When C++ exceptions are disabled, the C++ library defines |try| and 27 // When C++ exceptions are disabled, the C++ library defines |try| and
29 // |catch| so as to allow exception-expecting C++ code to build properly when 28 // |catch| so as to allow exception-expecting C++ code to build properly when
30 // language support for exceptions is not present. These macros interfere 29 // language support for exceptions is not present. These macros interfere
31 // with the use of |@try| and |@catch| in Objective-C files such as this one. 30 // with the use of |@try| and |@catch| in Objective-C files such as this one.
32 // Undefine these macros here, after everything has been #included, since 31 // Undefine these macros here, after everything has been #included, since
33 // there will be no C++ uses and only Objective-C uses from this point on. 32 // there will be no C++ uses and only Objective-C uses from this point on.
34 #undef try 33 #undef try
35 #undef catch 34 #undef catch
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 forBrowserState:browserState]; 204 forBrowserState:browserState];
206 return window; 205 return window;
207 } 206 }
208 207
209 - (SessionWindowIOS*)loadWindowFromPath:(NSString*)path 208 - (SessionWindowIOS*)loadWindowFromPath:(NSString*)path
210 forBrowserState:(ios::ChromeBrowserState*)browserState { 209 forBrowserState:(ios::ChromeBrowserState*)browserState {
211 // HACK: Handle the case where we had to change the class name of a persisted 210 // HACK: Handle the case where we had to change the class name of a persisted
212 // class on disk. 211 // class on disk.
213 [SessionWindowUnarchiver setClass:[CRWSessionCertificatePolicyManager class] 212 [SessionWindowUnarchiver setClass:[CRWSessionCertificatePolicyManager class]
214 forClassName:@"SessionCertificatePolicyManager"]; 213 forClassName:@"SessionCertificatePolicyManager"];
215 [SessionWindowUnarchiver setClass:[CRWNavigationManagerStorage class] 214 [SessionWindowUnarchiver setClass:[CRWSessionController class]
216 forClassName:@"SessionController"]; 215 forClassName:@"SessionController"];
217 [SessionWindowUnarchiver setClass:[CRWNavigationManagerStorage class]
218 forClassName:@"CRWSessionController"];
219 [SessionWindowUnarchiver setClass:[CRWSessionEntry class] 216 [SessionWindowUnarchiver setClass:[CRWSessionEntry class]
220 forClassName:@"SessionEntry"]; 217 forClassName:@"SessionEntry"];
221 // TODO(crbug.com/661633): Remove this hack. 218 // TODO(crbug.com/661633): Remove this hack.
222 [SessionWindowUnarchiver setClass:[SessionWindowIOS class] 219 [SessionWindowUnarchiver setClass:[SessionWindowIOS class]
223 forClassName:@"SessionWindow"]; 220 forClassName:@"SessionWindow"];
224 SessionWindowIOS* window = nil; 221 SessionWindowIOS* window = nil;
225 @try { 222 @try {
226 NSData* data = [NSData dataWithContentsOfFile:path]; 223 NSData* data = [NSData dataWithContentsOfFile:path];
227 if (data) { 224 if (data) {
228 base::scoped_nsobject<SessionWindowUnarchiver> unarchiver([ 225 base::scoped_nsobject<SessionWindowUnarchiver> unarchiver([
(...skipping 16 matching lines...) Expand all
245 base::ThreadRestrictions::AssertIOAllowed(); 242 base::ThreadRestrictions::AssertIOAllowed();
246 NSFileManager* fileManager = [NSFileManager defaultManager]; 243 NSFileManager* fileManager = [NSFileManager defaultManager];
247 if (![fileManager fileExistsAtPath:sessionFile]) 244 if (![fileManager fileExistsAtPath:sessionFile])
248 return; 245 return;
249 if (![fileManager removeItemAtPath:sessionFile error:nil]) 246 if (![fileManager removeItemAtPath:sessionFile error:nil])
250 CHECK(false) << "Unable to delete session file."; 247 CHECK(false) << "Unable to delete session file.";
251 })); 248 }));
252 } 249 }
253 250
254 @end 251 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/crash_report/crash_restore_helper.mm ('k') | ios/chrome/browser/sessions/session_service_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698