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

Side by Side Diff: components/offline_pages/core/task.cc

Issue 2359933007: [Offline pages] Introduces TaskQueue to serialize tasks that asynchronously access SQLStore (Closed)
Patch Set: Addressing gn problems, adding missing test file to build Created 4 years, 2 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/offline_pages/core/task.h"
6
7 #include "base/bind.h"
8 #include "base/threading/thread_task_runner_handle.h"
9
10 namespace offline_pages {
11
12 Task::Task() {}
13
14 Task::~Task() {}
15
16 void Task::SetCompletionCallback(
17 scoped_refptr<base::SingleThreadTaskRunner> runner,
18 const CompletionCallback& callback) {
19 DCHECK(runner);
20 DCHECK(!callback.is_null());
21 completion_runner_ = runner;
22 completion_callback_ = callback;
23 }
24
25 void Task::Complete() {
26 if (completion_callback_.is_null() || !completion_runner_)
27 return;
28
29 completion_runner_->PostTask(FROM_HERE,
30 base::Bind(completion_callback_, this));
31 }
32
33 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698