OLD | NEW |
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 #ifndef COMPONENTS_EXO_SURFACE_H_ | 5 #ifndef COMPONENTS_EXO_SURFACE_H_ |
6 #define COMPONENTS_EXO_SURFACE_H_ | 6 #define COMPONENTS_EXO_SURFACE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | |
10 #include <set> | 9 #include <set> |
11 #include <utility> | 10 #include <utility> |
12 | 11 |
13 #include "base/callback.h" | 12 #include "base/callback.h" |
14 #include "base/macros.h" | 13 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
18 #include "cc/output/begin_frame_args.h" | |
19 #include "cc/resources/transferable_resource.h" | 17 #include "cc/resources/transferable_resource.h" |
20 #include "cc/scheduler/begin_frame_source.h" | 18 #include "cc/scheduler/begin_frame_source.h" |
21 #include "cc/surfaces/local_surface_id_allocator.h" | |
22 #include "components/exo/compositor_frame_sink.h" | |
23 #include "components/exo/compositor_frame_sink_holder.h" | 19 #include "components/exo/compositor_frame_sink_holder.h" |
24 #include "third_party/skia/include/core/SkBlendMode.h" | 20 #include "third_party/skia/include/core/SkBlendMode.h" |
25 #include "third_party/skia/include/core/SkRegion.h" | 21 #include "third_party/skia/include/core/SkRegion.h" |
26 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
27 #include "ui/aura/window_observer.h" | 23 #include "ui/aura/window_observer.h" |
28 #include "ui/compositor/compositor_vsync_manager.h" | 24 #include "ui/compositor/compositor_vsync_manager.h" |
29 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
30 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
31 | 27 |
32 namespace base { | 28 namespace base { |
33 namespace trace_event { | 29 namespace trace_event { |
34 class TracedValue; | 30 class TracedValue; |
35 } | 31 } |
36 } | 32 } |
37 | 33 |
38 namespace cc { | |
39 class LocalSurfaceIdAllocator; | |
40 } | |
41 | |
42 namespace gfx { | 34 namespace gfx { |
43 class Path; | 35 class Path; |
44 } | 36 } |
45 | 37 |
46 namespace exo { | 38 namespace exo { |
47 class Buffer; | 39 class Buffer; |
48 class Pointer; | 40 class Pointer; |
49 class SurfaceDelegate; | 41 class SurfaceDelegate; |
50 class SurfaceObserver; | 42 class SurfaceObserver; |
51 class Surface; | 43 class Surface; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // This is true when Attach() has been called and new contents should take | 305 // This is true when Attach() has been called and new contents should take |
314 // effect next time Commit() is called. | 306 // effect next time Commit() is called. |
315 bool has_pending_contents_ = false; | 307 bool has_pending_contents_ = false; |
316 | 308 |
317 // The buffer that will become the content of surface when Commit() is called. | 309 // The buffer that will become the content of surface when Commit() is called. |
318 BufferAttachment pending_buffer_; | 310 BufferAttachment pending_buffer_; |
319 | 311 |
320 // The device scale factor sent in CompositorFrames. | 312 // The device scale factor sent in CompositorFrames. |
321 float device_scale_factor_ = 1.0f; | 313 float device_scale_factor_ = 1.0f; |
322 | 314 |
323 const cc::FrameSinkId frame_sink_id_; | 315 std::unique_ptr<CompositorFrameSinkHolder> compositor_frame_sink_holder_; |
324 cc::LocalSurfaceId local_surface_id_; | |
325 | |
326 scoped_refptr<CompositorFrameSinkHolder> compositor_frame_sink_holder_; | |
327 | |
328 cc::LocalSurfaceIdAllocator id_allocator_; | |
329 | 316 |
330 // The next resource id the buffer will be attached to. | 317 // The next resource id the buffer will be attached to. |
331 int next_resource_id_ = 1; | 318 int next_resource_id_ = 1; |
332 | 319 |
333 // The damage region to schedule paint for when Commit() is called. | 320 // The damage region to schedule paint for when Commit() is called. |
334 SkRegion pending_damage_; | 321 SkRegion pending_damage_; |
335 | 322 |
336 // These lists contains the callbacks to notify the client when it is a good | 323 // These lists contains the callbacks to notify the client when it is a good |
337 // time to start producing a new frame. These callbacks move to | 324 // time to start producing a new frame. These callbacks move to |
338 // |frame_callbacks_| when Commit() is called. Later they are moved to | 325 // |frame_callbacks_| when Commit() is called. Later they are moved to |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 std::set<CursorProvider*> cursor_providers_; | 375 std::set<CursorProvider*> cursor_providers_; |
389 | 376 |
390 // This can be set to have some functions delegated. E.g. ShellSurface class | 377 // This can be set to have some functions delegated. E.g. ShellSurface class |
391 // can set this to handle Commit() and apply any double buffered state it | 378 // can set this to handle Commit() and apply any double buffered state it |
392 // maintains. | 379 // maintains. |
393 SurfaceDelegate* delegate_ = nullptr; | 380 SurfaceDelegate* delegate_ = nullptr; |
394 | 381 |
395 // Surface observer list. Surface does not own the observers. | 382 // Surface observer list. Surface does not own the observers. |
396 base::ObserverList<SurfaceObserver, true> observers_; | 383 base::ObserverList<SurfaceObserver, true> observers_; |
397 | 384 |
398 // A reference factory that uses the compositor frame sink holder provided | |
399 // to this class to construct surface references. This object is passed to | |
400 // ui::Layer::SetShowSurface because the layer needs to know how to add | |
401 // references to surfaces. | |
402 scoped_refptr<cc::SurfaceReferenceFactory> surface_reference_factory_; | |
403 | |
404 // The begin frame source being observed. | 385 // The begin frame source being observed. |
405 cc::BeginFrameSource* begin_frame_source_ = nullptr; | 386 cc::BeginFrameSource* begin_frame_source_ = nullptr; |
406 bool needs_begin_frame_ = false; | 387 bool needs_begin_frame_ = false; |
407 cc::BeginFrameAck current_begin_frame_ack_; | 388 cc::BeginFrameAck current_begin_frame_ack_; |
408 | 389 |
409 DISALLOW_COPY_AND_ASSIGN(Surface); | 390 DISALLOW_COPY_AND_ASSIGN(Surface); |
410 }; | 391 }; |
411 | 392 |
412 } // namespace exo | 393 } // namespace exo |
413 | 394 |
414 #endif // COMPONENTS_EXO_SURFACE_H_ | 395 #endif // COMPONENTS_EXO_SURFACE_H_ |
OLD | NEW |