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

Side by Side Diff: chrome/browser/chromeos/device/input_service_proxy.cc

Issue 1036723003: favor DCHECK_CURRENTLY_ON for better logs in chrome/browser/chromeos/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/chromeos/device/input_service_proxy.h" 5 #include "chrome/browser/chromeos/device/input_service_proxy.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/task_runner_util.h" 8 #include "base/task_runner_util.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 10
11 using content::BrowserThread; 11 using content::BrowserThread;
12 using device::InputServiceLinux; 12 using device::InputServiceLinux;
13 13
14 typedef device::InputServiceLinux::InputDeviceInfo InputDeviceInfo; 14 typedef device::InputServiceLinux::InputDeviceInfo InputDeviceInfo;
15 15
16 namespace chromeos { 16 namespace chromeos {
17 17
18 // static 18 // static
19 BrowserThread::ID InputServiceProxy::thread_identifier_ = BrowserThread::FILE; 19 BrowserThread::ID InputServiceProxy::thread_identifier_ = BrowserThread::FILE;
20 20
21 class InputServiceProxy::ServiceObserver : public InputServiceLinux::Observer { 21 class InputServiceProxy::ServiceObserver : public InputServiceLinux::Observer {
22 public: 22 public:
23 ServiceObserver() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } 23 ServiceObserver() { DCHECK_CURRENTLY_ON(BrowserThread::UI); }
24 ~ServiceObserver() override { DCHECK(CalledOnValidThread()); } 24 ~ServiceObserver() override { DCHECK(CalledOnValidThread()); }
25 25
26 void Initialize(const base::WeakPtr<InputServiceProxy>& proxy) { 26 void Initialize(const base::WeakPtr<InputServiceProxy>& proxy) {
27 DCHECK(CalledOnValidThread()); 27 DCHECK(CalledOnValidThread());
28 InputServiceLinux::GetInstance()->AddObserver(this); 28 InputServiceLinux::GetInstance()->AddObserver(this);
29 proxy_ = proxy; 29 proxy_ = proxy;
30 } 30 }
31 31
32 void Shutdown() { 32 void Shutdown() {
33 DCHECK(CalledOnValidThread()); 33 DCHECK(CalledOnValidThread());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 base::WeakPtr<InputServiceProxy> proxy_; 82 base::WeakPtr<InputServiceProxy> proxy_;
83 83
84 DISALLOW_COPY_AND_ASSIGN(ServiceObserver); 84 DISALLOW_COPY_AND_ASSIGN(ServiceObserver);
85 }; 85 };
86 86
87 InputServiceProxy::InputServiceProxy() 87 InputServiceProxy::InputServiceProxy()
88 : service_observer_(new ServiceObserver()), 88 : service_observer_(new ServiceObserver()),
89 task_runner_(BrowserThread::GetMessageLoopProxyForThread( 89 task_runner_(BrowserThread::GetMessageLoopProxyForThread(
90 thread_identifier_)), 90 thread_identifier_)),
91 weak_factory_(this) { 91 weak_factory_(this) {
92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 92 DCHECK_CURRENTLY_ON(BrowserThread::UI);
93 task_runner_->PostTask( 93 task_runner_->PostTask(
94 FROM_HERE, 94 FROM_HERE,
95 base::Bind(&InputServiceProxy::ServiceObserver::Initialize, 95 base::Bind(&InputServiceProxy::ServiceObserver::Initialize,
96 base::Unretained(service_observer_.get()), 96 base::Unretained(service_observer_.get()),
97 weak_factory_.GetWeakPtr())); 97 weak_factory_.GetWeakPtr()));
98 } 98 }
99 99
100 InputServiceProxy::~InputServiceProxy() { 100 InputServiceProxy::~InputServiceProxy() {
101 DCHECK(thread_checker_.CalledOnValidThread()); 101 DCHECK(thread_checker_.CalledOnValidThread());
102 task_runner_->PostTask( 102 task_runner_->PostTask(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 DCHECK(thread_checker_.CalledOnValidThread()); 156 DCHECK(thread_checker_.CalledOnValidThread());
157 FOR_EACH_OBSERVER(Observer, observers_, OnInputDeviceAdded(info)); 157 FOR_EACH_OBSERVER(Observer, observers_, OnInputDeviceAdded(info));
158 } 158 }
159 159
160 void InputServiceProxy::OnDeviceRemoved(const std::string& id) { 160 void InputServiceProxy::OnDeviceRemoved(const std::string& id) {
161 DCHECK(thread_checker_.CalledOnValidThread()); 161 DCHECK(thread_checker_.CalledOnValidThread());
162 FOR_EACH_OBSERVER(Observer, observers_, OnInputDeviceRemoved(id)); 162 FOR_EACH_OBSERVER(Observer, observers_, OnInputDeviceRemoved(id));
163 } 163 }
164 164
165 } // namespace chromeos 165 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/customization/customization_document.cc ('k') | chrome/browser/chromeos/drive/change_list_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698