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

Side by Side Diff: content/browser/notifications/platform_notification_context_impl.cc

Issue 2882653003: Use TaskScheduler instead of SequencedWorkerPool in platform_notification_context_impl.cc. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "content/browser/notifications/platform_notification_context_impl.h" 5 #include "content/browser/notifications/platform_notification_context_impl.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/threading/sequenced_worker_pool.h" 12 #include "base/task_scheduler/post_task.h"
13 #include "content/browser/notifications/blink_notification_service_impl.h" 13 #include "content/browser/notifications/blink_notification_service_impl.h"
14 #include "content/browser/notifications/notification_database.h" 14 #include "content/browser/notifications/notification_database.h"
15 #include "content/browser/service_worker/service_worker_context_wrapper.h" 15 #include "content/browser/service_worker/service_worker_context_wrapper.h"
16 #include "content/public/browser/browser_context.h" 16 #include "content/public/browser/browser_context.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/content_browser_client.h" 18 #include "content/public/browser/content_browser_client.h"
19 #include "content/public/browser/notification_database_data.h" 19 #include "content/public/browser/notification_database_data.h"
20 #include "content/public/browser/platform_notification_service.h" 20 #include "content/public/browser/platform_notification_service.h"
21 21
22 using base::DoNothing; 22 using base::DoNothing;
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 this), 471 this),
472 base::Bind(&DoNothing)); 472 base::Bind(&DoNothing));
473 } 473 }
474 474
475 void PlatformNotificationContextImpl::LazyInitialize( 475 void PlatformNotificationContextImpl::LazyInitialize(
476 const base::Closure& success_closure, 476 const base::Closure& success_closure,
477 const base::Closure& failure_closure) { 477 const base::Closure& failure_closure) {
478 DCHECK_CURRENTLY_ON(BrowserThread::IO); 478 DCHECK_CURRENTLY_ON(BrowserThread::IO);
479 479
480 if (!task_runner_) { 480 if (!task_runner_) {
481 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); 481 task_runner_ = base::CreateSequencedTaskRunnerWithTraits(
482 base::SequencedWorkerPool::SequenceToken token = pool->GetSequenceToken(); 482 {base::MayBlock(), base::TaskPriority::BACKGROUND});
483
484 task_runner_ = pool->GetSequencedTaskRunner(token);
485 } 483 }
486 484
487 task_runner_->PostTask( 485 task_runner_->PostTask(
488 FROM_HERE, base::Bind(&PlatformNotificationContextImpl::OpenDatabase, 486 FROM_HERE, base::Bind(&PlatformNotificationContextImpl::OpenDatabase,
489 this, success_closure, failure_closure)); 487 this, success_closure, failure_closure));
490 } 488 }
491 489
492 void PlatformNotificationContextImpl::OpenDatabase( 490 void PlatformNotificationContextImpl::OpenDatabase(
493 const base::Closure& success_closure, 491 const base::Closure& success_closure,
494 const base::Closure& failure_closure) { 492 const base::Closure& failure_closure) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 566
569 return path_.Append(kPlatformNotificationsDirectory); 567 return path_.Append(kPlatformNotificationsDirectory);
570 } 568 }
571 569
572 void PlatformNotificationContextImpl::SetTaskRunnerForTesting( 570 void PlatformNotificationContextImpl::SetTaskRunnerForTesting(
573 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { 571 const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
574 task_runner_ = task_runner; 572 task_runner_ = task_runner;
575 } 573 }
576 574
577 } // namespace content 575 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698