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

Side by Side Diff: components/previews/previews_io_data.cc

Issue 2333003002: Changed previews component to be a layered component. (Closed)
Patch Set: Rebased on master Created 4 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 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/previews/previews_io_data.h"
6
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "components/previews/previews_ui_service.h"
10
11 namespace previews {
12
13 PreviewsIOData::PreviewsIOData(
14 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner,
15 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner)
16 : ui_task_runner_(ui_task_runner),
17 io_task_runner_(io_task_runner),
18 weak_factory_(this) {}
19
20 PreviewsIOData::~PreviewsIOData() {}
21
22 void PreviewsIOData::Initialize(
23 base::WeakPtr<PreviewsUIService> previews_ui_service) {
24 DCHECK(ui_task_runner_->BelongsToCurrentThread());
25 previews_ui_service_ = previews_ui_service;
26
27 // Set up the IO thread portion of |this|.
28 io_task_runner_->PostTask(FROM_HERE,
29 base::Bind(&PreviewsIOData::InitializeOnIOThread,
30 base::Unretained(this)));
31 }
32
33 void PreviewsIOData::InitializeOnIOThread() {
34 DCHECK(io_task_runner_->BelongsToCurrentThread());
35 ui_task_runner_->PostTask(
36 FROM_HERE, base::Bind(&PreviewsUIService::SetIOData, previews_ui_service_,
37 weak_factory_.GetWeakPtr()));
38 }
39
40 } // namespace previews
OLDNEW
« no previous file with comments | « components/previews/previews_io_data.h ('k') | components/previews/previews_io_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698