From 3b7bbdee66154192e114f69457e411fcce7333a9 Mon Sep 17 00:00:00 2001 From: fdoray Date: Tue, 16 May 2017 05:16:38 -0700 Subject: [PATCH] Use TaskScheduler instead of SequencedWorkerPool in session_service_ios.mm. SequencedWorkerPool is being deprecated in favor of TaskScheduler. BUG=667892 R=rohitrao@chromium.org Review-Url: https://codereview.chromium.org/2878953002 Cr-Commit-Position: refs/heads/master@{#472064} --- .../browser/sessions/session_service_ios.mm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ios/chrome/browser/sessions/session_service_ios.mm b/ios/chrome/browser/sessions/session_service_ios.mm index c2f1be5833b9ed..c115856a3aa798 100644 --- a/ios/chrome/browser/sessions/session_service_ios.mm +++ b/ios/chrome/browser/sessions/session_service_ios.mm @@ -6,7 +6,6 @@ #import -#include "base/critical_closure.h" #include "base/files/file_path.h" #include "base/format_macros.h" #include "base/location.h" @@ -16,14 +15,13 @@ #include "base/memory/ref_counted.h" #include "base/sequenced_task_runner.h" #include "base/strings/sys_string_conversions.h" -#include "base/threading/sequenced_worker_pool.h" +#include "base/task_scheduler/post_task.h" #include "base/threading/thread_restrictions.h" #import "ios/chrome/browser/sessions/session_ios.h" #import "ios/chrome/browser/sessions/session_window_ios.h" #import "ios/web/public/crw_navigation_item_storage.h" #import "ios/web/public/crw_session_certificate_policy_cache_storage.h" #import "ios/web/public/crw_session_storage.h" -#include "ios/web/public/web_thread.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -82,9 +80,10 @@ @implementation SessionServiceIOS { #pragma mark - NSObject overrides - (instancetype)init { - base::SequencedWorkerPool* pool = web::WebThread::GetBlockingPool(); scoped_refptr taskRunner = - pool->GetSequencedTaskRunner(pool->GetSequenceToken()); + base::CreateSequencedTaskRunnerWithTraits( + {base::MayBlock(), base::TaskPriority::BACKGROUND, + base::TaskShutdownBehavior::BLOCK_SHUTDOWN}); return [self initWithTaskRunner:taskRunner]; } @@ -200,10 +199,10 @@ - (void)performSaveToPathInBackground:(NSString*)sessionPath { @try { NSData* sessionData = [NSKeyedArchiver archivedDataWithRootObject:session]; - _taskRunner->PostTask( - FROM_HERE, base::MakeCriticalClosure(base::BindBlockArc(^{ - [self performSaveSessionData:sessionData sessionPath:sessionPath]; - }))); + _taskRunner->PostTask(FROM_HERE, base::BindBlockArc(^{ + [self performSaveSessionData:sessionData + sessionPath:sessionPath]; + })); } @catch (NSException* exception) { NOTREACHED() << "Error serializing session for path: " << base::SysNSStringToUTF8(sessionPath) << ": "