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

Side by Side Diff: ui/ozone/platform/drm/gpu/hardware_display_plane_manager_atomic.cc

Issue 2930273002: Use ContainsValue() instead of std::find() in ui/accessibility, ui/gl and ui/ozone (Closed)
Patch Set: Created 3 years, 6 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 "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_atomic.h" 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_atomic.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h"
8 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" 9 #include "ui/ozone/platform/drm/gpu/crtc_controller.h"
9 #include "ui/ozone/platform/drm/gpu/drm_device.h" 10 #include "ui/ozone/platform/drm/gpu/drm_device.h"
10 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.h" 11 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.h"
11 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" 12 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h"
12 13
13 namespace ui { 14 namespace ui {
14 15
15 namespace { 16 namespace {
16 17
17 void AtomicPageFlipCallback(std::vector<base::WeakPtr<CrtcController>> crtcs, 18 void AtomicPageFlipCallback(std::vector<base::WeakPtr<CrtcController>> crtcs,
(...skipping 12 matching lines...) Expand all
30 HardwareDisplayPlaneManagerAtomic::HardwareDisplayPlaneManagerAtomic() { 31 HardwareDisplayPlaneManagerAtomic::HardwareDisplayPlaneManagerAtomic() {
31 } 32 }
32 33
33 HardwareDisplayPlaneManagerAtomic::~HardwareDisplayPlaneManagerAtomic() { 34 HardwareDisplayPlaneManagerAtomic::~HardwareDisplayPlaneManagerAtomic() {
34 } 35 }
35 36
36 bool HardwareDisplayPlaneManagerAtomic::Commit( 37 bool HardwareDisplayPlaneManagerAtomic::Commit(
37 HardwareDisplayPlaneList* plane_list, 38 HardwareDisplayPlaneList* plane_list,
38 bool test_only) { 39 bool test_only) {
39 for (HardwareDisplayPlane* plane : plane_list->old_plane_list) { 40 for (HardwareDisplayPlane* plane : plane_list->old_plane_list) {
40 bool found = 41 bool found = base::ContainsValue(plane_list->plane_list, plane);
41 std::find(plane_list->plane_list.begin(), plane_list->plane_list.end(),
42 plane) != plane_list->plane_list.end();
43 if (!found) { 42 if (!found) {
sadrul 2017/06/14 02:43:01 Don't need |found|. Just check if (base::ContainsV
Tripta 2017/06/14 05:46:17 Done.
44 // This plane is being released, so we need to zero it. 43 // This plane is being released, so we need to zero it.
45 plane->set_in_use(false); 44 plane->set_in_use(false);
46 HardwareDisplayPlaneAtomic* atomic_plane = 45 HardwareDisplayPlaneAtomic* atomic_plane =
47 static_cast<HardwareDisplayPlaneAtomic*>(plane); 46 static_cast<HardwareDisplayPlaneAtomic*>(plane);
48 atomic_plane->SetPlaneData(plane_list->atomic_property_set.get(), 0, 0, 47 atomic_plane->SetPlaneData(plane_list->atomic_property_set.get(), 0, 0,
49 gfx::Rect(), gfx::Rect(), 48 gfx::Rect(), gfx::Rect(),
50 gfx::OVERLAY_TRANSFORM_NONE); 49 gfx::OVERLAY_TRANSFORM_NONE);
51 } 50 }
52 } 51 }
53 52
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 109 }
111 110
112 std::unique_ptr<HardwareDisplayPlane> 111 std::unique_ptr<HardwareDisplayPlane>
113 HardwareDisplayPlaneManagerAtomic::CreatePlane(uint32_t plane_id, 112 HardwareDisplayPlaneManagerAtomic::CreatePlane(uint32_t plane_id,
114 uint32_t possible_crtcs) { 113 uint32_t possible_crtcs) {
115 return std::unique_ptr<HardwareDisplayPlane>( 114 return std::unique_ptr<HardwareDisplayPlane>(
116 new HardwareDisplayPlaneAtomic(plane_id, possible_crtcs)); 115 new HardwareDisplayPlaneAtomic(plane_id, possible_crtcs));
117 } 116 }
118 117
119 } // namespace ui 118 } // namespace ui
OLDNEW
« ui/accessibility/ax_tree_unittest.cc ('K') | « ui/gl/test/egl_initialization_displays_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698