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

Side by Side Diff: ui/ozone/platform/drm/mus_thread_proxy.cc

Issue 2422073002: Reduce FOR_EACH_OBSERVER usage in ui/ (Closed)
Patch Set: remove space 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
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 #include "ui/ozone/platform/drm/mus_thread_proxy.h" 5 #include "ui/ozone/platform/drm/mus_thread_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/task_runner.h" 9 #include "base/task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 24 matching lines...) Expand all
35 35
36 MusThreadProxy::MusThreadProxy() 36 MusThreadProxy::MusThreadProxy()
37 : ws_task_runner_(base::ThreadTaskRunnerHandle::Get()), 37 : ws_task_runner_(base::ThreadTaskRunnerHandle::Get()),
38 drm_thread_(nullptr), 38 drm_thread_(nullptr),
39 weak_ptr_factory_(this) {} 39 weak_ptr_factory_(this) {}
40 40
41 void MusThreadProxy::InitializeOnEvdev() {} 41 void MusThreadProxy::InitializeOnEvdev() {}
42 42
43 MusThreadProxy::~MusThreadProxy() { 43 MusThreadProxy::~MusThreadProxy() {
44 DCHECK(on_window_server_thread_.CalledOnValidThread()); 44 DCHECK(on_window_server_thread_.CalledOnValidThread());
45 FOR_EACH_OBSERVER(GpuThreadObserver, gpu_thread_observers_, 45 for (GpuThreadObserver& observer : gpu_thread_observers_)
46 OnGpuThreadRetired()); 46 observer.OnGpuThreadRetired();
47 } 47 }
48 48
49 // This is configured on the GPU thread. 49 // This is configured on the GPU thread.
50 void MusThreadProxy::SetDrmThread(DrmThread* thread) { 50 void MusThreadProxy::SetDrmThread(DrmThread* thread) {
51 base::AutoLock acquire(lock_); 51 base::AutoLock acquire(lock_);
52 drm_thread_ = thread; 52 drm_thread_ = thread;
53 } 53 }
54 54
55 void MusThreadProxy::ProvideManagers(DrmDisplayHostManager* display_manager, 55 void MusThreadProxy::ProvideManagers(DrmDisplayHostManager* display_manager,
56 DrmOverlayManager* overlay_manager) { 56 DrmOverlayManager* overlay_manager) {
(...skipping 10 matching lines...) Expand all
67 base::Unretained(this))); 67 base::Unretained(this)));
68 } 68 }
69 69
70 void MusThreadProxy::DispatchObserversFromDrmThread() { 70 void MusThreadProxy::DispatchObserversFromDrmThread() {
71 ws_task_runner_->PostTask(FROM_HERE, base::Bind(&MusThreadProxy::RunObservers, 71 ws_task_runner_->PostTask(FROM_HERE, base::Bind(&MusThreadProxy::RunObservers,
72 base::Unretained(this))); 72 base::Unretained(this)));
73 } 73 }
74 74
75 void MusThreadProxy::RunObservers() { 75 void MusThreadProxy::RunObservers() {
76 DCHECK(on_window_server_thread_.CalledOnValidThread()); 76 DCHECK(on_window_server_thread_.CalledOnValidThread());
77 FOR_EACH_OBSERVER(GpuThreadObserver, gpu_thread_observers_, 77 for (GpuThreadObserver& observer : gpu_thread_observers_)
78 OnGpuThreadReady()); 78 observer.OnGpuThreadReady();
79 } 79 }
80 80
81 void MusThreadProxy::AddGpuThreadObserver(GpuThreadObserver* observer) { 81 void MusThreadProxy::AddGpuThreadObserver(GpuThreadObserver* observer) {
82 DCHECK(on_window_server_thread_.CalledOnValidThread()); 82 DCHECK(on_window_server_thread_.CalledOnValidThread());
83 83
84 gpu_thread_observers_.AddObserver(observer); 84 gpu_thread_observers_.AddObserver(observer);
85 if (IsConnected()) 85 if (IsConnected())
86 observer->OnGpuThreadReady(); 86 observer->OnGpuThreadReady();
87 } 87 }
88 88
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 display_manager_->GpuReceivedHDCPState(display_id, success, state); 350 display_manager_->GpuReceivedHDCPState(display_id, success, state);
351 } 351 }
352 352
353 void MusThreadProxy::GpuSetHDCPStateCallback(int64_t display_id, 353 void MusThreadProxy::GpuSetHDCPStateCallback(int64_t display_id,
354 bool success) const { 354 bool success) const {
355 DCHECK(on_window_server_thread_.CalledOnValidThread()); 355 DCHECK(on_window_server_thread_.CalledOnValidThread());
356 display_manager_->GpuUpdatedHDCPState(display_id, success); 356 display_manager_->GpuUpdatedHDCPState(display_id, success);
357 } 357 }
358 358
359 } // namespace ui 359 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/host/drm_native_display_delegate.cc ('k') | ui/snapshot/screenshot_grabber.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698