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

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

Issue 2335023002: Adding a previews IO-thread blacklist (Closed)
Patch Set: tbansal comments 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #ifndef COMPONENTS_PREVIEWS_PREVIEWS_UI_SERVICE_H_ 5 #ifndef COMPONENTS_PREVIEWS_PREVIEWS_UI_SERVICE_H_
6 #define COMPONENTS_PREVIEWS_PREVIEWS_UI_SERVICE_H_ 6 #define COMPONENTS_PREVIEWS_PREVIEWS_UI_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/single_thread_task_runner.h"
14 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "base/time/time.h"
15 #include "components/previews/previews_opt_out_store.h"
16
17 namespace base {
18 class SingleThreadTaskRunner;
19 }
15 20
16 namespace previews { 21 namespace previews {
17 class PreviewsIOData; 22 class PreviewsIOData;
18 23
19 // A class to manage the UI portion of inter-thread communication between 24 // A class to manage the UI portion of inter-thread communication between
20 // previews/ objects. Created and used on the UI thread. 25 // previews/ objects. Created and used on the UI thread.
21 class PreviewsUIService { 26 class PreviewsUIService {
22 public: 27 public:
23 PreviewsUIService( 28 PreviewsUIService(
24 PreviewsIOData* previews_io_data, 29 PreviewsIOData* previews_io_data,
25 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); 30 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
31 std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store);
26 virtual ~PreviewsUIService(); 32 virtual ~PreviewsUIService();
27 33
28 // Sets |io_data_| to |io_data| to allow calls from the UI thread to the IO 34 // Sets |io_data_| to |io_data| to allow calls from the UI thread to the IO
29 // thread. Virtualized in testing. 35 // thread. Virtualized in testing.
30 virtual void SetIOData(base::WeakPtr<PreviewsIOData> io_data); 36 virtual void SetIOData(base::WeakPtr<PreviewsIOData> io_data);
31 37
32 private: 38 private:
33 // The IO thread portion of the inter-thread communication for previews/. 39 // The IO thread portion of the inter-thread communication for previews/.
34 base::WeakPtr<previews::PreviewsIOData> io_data_; 40 base::WeakPtr<previews::PreviewsIOData> io_data_;
35 41
36 base::ThreadChecker thread_checker_; 42 base::ThreadChecker thread_checker_;
37 43
38 // The IO thread task runner. Used to post tasks to |io_data_|. 44 // The IO thread task runner. Used to post tasks to |io_data_|.
39 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 45 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
40 46
41 base::WeakPtrFactory<PreviewsUIService> weak_factory_; 47 base::WeakPtrFactory<PreviewsUIService> weak_factory_;
42 48
43 DISALLOW_COPY_AND_ASSIGN(PreviewsUIService); 49 DISALLOW_COPY_AND_ASSIGN(PreviewsUIService);
44 }; 50 };
45 51
46 } // namespace previews 52 } // namespace previews
47 53
48 #endif // COMPONENTS_PREVIEWS_PREVIEWS_UI_SERVICE_H_ 54 #endif // COMPONENTS_PREVIEWS_PREVIEWS_UI_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698