| 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 SERVICES_GFX_COMPOSITOR_GRAPH_SNAPSHOT_H_ | 5 #ifndef SERVICES_GFX_COMPOSITOR_GRAPH_SNAPSHOT_H_ |
| 6 #define SERVICES_GFX_COMPOSITOR_GRAPH_SNAPSHOT_H_ | 6 #define SERVICES_GFX_COMPOSITOR_GRAPH_SNAPSHOT_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "mojo/services/geometry/interfaces/geometry.mojom.h" | 14 #include "mojo/services/geometry/interfaces/geometry.mojom.h" |
| 15 #include "mojo/services/gfx/composition/interfaces/hit_tests.mojom.h" | 15 #include "mojo/services/gfx/composition/interfaces/hit_tests.mojom.h" |
| 16 #include "mojo/services/gfx/composition/interfaces/scheduling.mojom.h" | 16 #include "mojo/services/gfx/composition/interfaces/scheduling.mojom.h" |
| 17 #include "services/gfx/compositor/render/render_frame.h" |
| 17 | 18 |
| 18 namespace compositor { | 19 namespace compositor { |
| 19 | 20 |
| 20 class Node; | 21 class Node; |
| 21 class SceneContent; | 22 class SceneContent; |
| 22 class SceneNode; | 23 class SceneNode; |
| 23 class RenderFrame; | |
| 24 | 24 |
| 25 // Describes a single frame snapshot of the scene graph, sufficient for | 25 // Describes a single frame snapshot of the scene graph, sufficient for |
| 26 // rendering and hit testing. When the snapshot is made, all predicated and | 26 // rendering and hit testing. When the snapshot is made, all predicated and |
| 27 // blocked scene nodes are evaluated to produce a final description of | 27 // blocked scene nodes are evaluated to produce a final description of |
| 28 // the content of the frame along with its dependencies. | 28 // the content of the frame along with its dependencies. |
| 29 // | 29 // |
| 30 // The snapshot holds a list of dependencies for the scenes whose state was | 30 // The snapshot holds a list of dependencies for the scenes whose state was |
| 31 // originally used to produce it so that the snapshot can be invalidated | 31 // originally used to produce it so that the snapshot can be invalidated |
| 32 // whenever one of these scenes changes. Note that the snapshot will contain | 32 // whenever one of these scenes changes. Note that the snapshot will contain |
| 33 // a list of dependencies even when rendering is blocked, in which case | 33 // a list of dependencies even when rendering is blocked, in which case |
| (...skipping 22 matching lines...) Expand all Loading... |
| 56 // Gets the root scene content for the snapshot, or null if blocked. | 56 // Gets the root scene content for the snapshot, or null if blocked. |
| 57 const SceneContent* root_scene_content() const { | 57 const SceneContent* root_scene_content() const { |
| 58 return root_scene_content_.get(); | 58 return root_scene_content_.get(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Returns true if the snapshot has a dependency on content from the | 61 // Returns true if the snapshot has a dependency on content from the |
| 62 // specified scene. | 62 // specified scene. |
| 63 bool HasDependency( | 63 bool HasDependency( |
| 64 const mojo::gfx::composition::SceneToken& scene_token) const; | 64 const mojo::gfx::composition::SceneToken& scene_token) const; |
| 65 | 65 |
| 66 // Creates a frame for rendering. | 66 // Paints the content of the snapshot to produce a frame to be rendered. |
| 67 // Only valid if |!is_blocked()|. | 67 // Only valid if |!is_blocked()|. |
| 68 scoped_refptr<RenderFrame> CreateFrame( | 68 scoped_refptr<RenderFrame> Paint(const RenderFrame::Metadata& metadata, |
| 69 const mojo::Rect& viewport, | 69 const mojo::Rect& viewport) const; |
| 70 const mojo::gfx::composition::FrameInfo& frame_info) const; | |
| 71 | 70 |
| 72 // Performs a hit test at the specified point, populating the result. | 71 // Performs a hit test at the specified point, populating the result. |
| 73 // Only valid if |!is_blocked()|. | 72 // Only valid if |!is_blocked()|. |
| 74 void HitTest(const mojo::PointF& point, | 73 void HitTest(const mojo::PointF& point, |
| 75 mojo::gfx::composition::HitTestResult* result) const; | 74 mojo::gfx::composition::HitTestResult* result) const; |
| 76 | 75 |
| 77 // Returns true if the specified node was blocked from rendering. | 76 // Returns true if the specified node was blocked from rendering. |
| 78 // Only valid if |!is_blocked()|. | 77 // Only valid if |!is_blocked()|. |
| 79 bool IsNodeBlocked(const Node* node) const; | 78 bool IsNodeBlocked(const Node* node) const; |
| 80 | 79 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 157 |
| 159 scoped_refptr<Snapshot> snapshot_; | 158 scoped_refptr<Snapshot> snapshot_; |
| 160 std::ostream* const block_log_; | 159 std::ostream* const block_log_; |
| 161 | 160 |
| 162 DISALLOW_COPY_AND_ASSIGN(SnapshotBuilder); | 161 DISALLOW_COPY_AND_ASSIGN(SnapshotBuilder); |
| 163 }; | 162 }; |
| 164 | 163 |
| 165 } // namespace compositor | 164 } // namespace compositor |
| 166 | 165 |
| 167 #endif // SERVICES_GFX_COMPOSITOR_GRAPH_SNAPSHOT_H_ | 166 #endif // SERVICES_GFX_COMPOSITOR_GRAPH_SNAPSHOT_H_ |
| OLD | NEW |