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/exo/surface.cc

Issue 2632543003: Refactor and push window properties up to class properties. (Closed)
Patch Set: More build fixes Created 3 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/exo/surface.h" 5 #include "components/exo/surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
14 #include "base/trace_event/trace_event_argument.h" 14 #include "base/trace_event/trace_event_argument.h"
15 #include "cc/quads/render_pass.h" 15 #include "cc/quads/render_pass.h"
16 #include "cc/quads/shared_quad_state.h" 16 #include "cc/quads/shared_quad_state.h"
17 #include "cc/quads/solid_color_draw_quad.h" 17 #include "cc/quads/solid_color_draw_quad.h"
18 #include "cc/quads/texture_draw_quad.h" 18 #include "cc/quads/texture_draw_quad.h"
19 #include "cc/resources/single_release_callback.h" 19 #include "cc/resources/single_release_callback.h"
20 #include "cc/surfaces/sequence_surface_reference_factory.h" 20 #include "cc/surfaces/sequence_surface_reference_factory.h"
21 #include "cc/surfaces/surface.h" 21 #include "cc/surfaces/surface.h"
22 #include "cc/surfaces/surface_id_allocator.h" 22 #include "cc/surfaces/surface_id_allocator.h"
23 #include "components/exo/buffer.h" 23 #include "components/exo/buffer.h"
24 #include "components/exo/surface_delegate.h" 24 #include "components/exo/surface_delegate.h"
25 #include "components/exo/surface_observer.h" 25 #include "components/exo/surface_observer.h"
26 #include "third_party/khronos/GLES2/gl2.h" 26 #include "third_party/khronos/GLES2/gl2.h"
27 #include "ui/aura/env.h" 27 #include "ui/aura/env.h"
28 #include "ui/aura/window_delegate.h" 28 #include "ui/aura/window_delegate.h"
29 #include "ui/aura/window_property.h"
30 #include "ui/aura/window_targeter.h" 29 #include "ui/aura/window_targeter.h"
30 #include "ui/base/class_property.h"
31 #include "ui/base/cursor/cursor.h" 31 #include "ui/base/cursor/cursor.h"
32 #include "ui/base/hit_test.h" 32 #include "ui/base/hit_test.h"
33 #include "ui/compositor/layer.h" 33 #include "ui/compositor/layer.h"
34 #include "ui/events/event.h" 34 #include "ui/events/event.h"
35 #include "ui/gfx/buffer_format_util.h" 35 #include "ui/gfx/buffer_format_util.h"
36 #include "ui/gfx/geometry/safe_integer_conversions.h" 36 #include "ui/gfx/geometry/safe_integer_conversions.h"
37 #include "ui/gfx/geometry/size_conversions.h" 37 #include "ui/gfx/geometry/size_conversions.h"
38 #include "ui/gfx/gpu_memory_buffer.h" 38 #include "ui/gfx/gpu_memory_buffer.h"
39 #include "ui/gfx/path.h" 39 #include "ui/gfx/path.h"
40 #include "ui/gfx/skia_util.h" 40 #include "ui/gfx/skia_util.h"
41 #include "ui/gfx/transform_util.h" 41 #include "ui/gfx/transform_util.h"
42 #include "ui/views/widget/widget.h" 42 #include "ui/views/widget/widget.h"
43 43
44 DECLARE_WINDOW_PROPERTY_TYPE(exo::Surface*); 44 DECLARE_UI_CLASS_PROPERTY_TYPE(exo::Surface*);
45 45
46 namespace exo { 46 namespace exo {
47 namespace { 47 namespace {
48 48
49 // A property key containing the surface that is associated with 49 // A property key containing the surface that is associated with
50 // window. If unset, no surface is associated with window. 50 // window. If unset, no surface is associated with window.
51 DEFINE_WINDOW_PROPERTY_KEY(Surface*, kSurfaceKey, nullptr); 51 DEFINE_UI_CLASS_PROPERTY_KEY(Surface*, kSurfaceKey, nullptr);
52 52
53 // Helper function that returns an iterator to the first entry in |list| 53 // Helper function that returns an iterator to the first entry in |list|
54 // with |key|. 54 // with |key|.
55 template <typename T, typename U> 55 template <typename T, typename U>
56 typename T::iterator FindListEntry(T& list, U key) { 56 typename T::iterator FindListEntry(T& list, U key) {
57 return std::find_if(list.begin(), list.end(), 57 return std::find_if(list.begin(), list.end(),
58 [key](const typename T::value_type& entry) { 58 [key](const typename T::value_type& entry) {
59 return entry.first == key; 59 return entry.first == key;
60 }); 60 });
61 } 61 }
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 843
844 int64_t Surface::GetPropertyInternal(const void* key, 844 int64_t Surface::GetPropertyInternal(const void* key,
845 int64_t default_value) const { 845 int64_t default_value) const {
846 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); 846 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key);
847 if (iter == prop_map_.end()) 847 if (iter == prop_map_.end())
848 return default_value; 848 return default_value;
849 return iter->second.value; 849 return iter->second.value;
850 } 850 }
851 851
852 } // namespace exo 852 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698