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

Side by Side Diff: components/previews/previews_ui_service.h

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 #ifndef COMPONENTS_PREVIEWS_PREVIEWS_UI_SERVICE_H_
6 #define COMPONENTS_PREVIEWS_PREVIEWS_UI_SERVICE_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/single_thread_task_runner.h"
14 #include "base/threading/thread_checker.h"
15
16 namespace previews {
17 class PreviewsIOData;
18
19 // A class to manage the UI portion of inter-thread communication between
20 // previews/ objects. Created and used on the UI thread.
21 class PreviewsUIService {
22 public:
23 PreviewsUIService(
24 PreviewsIOData* previews_io_data,
25 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
26 virtual ~PreviewsUIService();
27
28 // Sets |io_data_| to |io_data| to allow calls from the UI thread to the IO
29 // thread. Virtualized in testing.
30 virtual void SetIOData(base::WeakPtr<PreviewsIOData> io_data);
31
32 private:
33 // The IO thread portion of the inter-thread communication for previews/.
34 base::WeakPtr<previews::PreviewsIOData> io_data_;
35
36 base::ThreadChecker thread_checker_;
37
38 // The IO thread task runner. Used to post tasks to |io_data_|.
39 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
40
41 base::WeakPtrFactory<PreviewsUIService> weak_factory_;
42
43 DISALLOW_COPY_AND_ASSIGN(PreviewsUIService);
44 };
45
46 } // namespace previews
47
48 #endif // COMPONENTS_PREVIEWS_PREVIEWS_UI_SERVICE_H_
OLDNEW
« no previous file with comments | « components/previews/previews_io_data_unittest.cc ('k') | components/previews/previews_ui_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698