| 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_RENDERER_STATE_H_ | 5 #ifndef SERVICES_GFX_COMPOSITOR_RENDERER_STATE_H_ |
| 6 #define SERVICES_GFX_COMPOSITOR_RENDERER_STATE_H_ | 6 #define SERVICES_GFX_COMPOSITOR_RENDERER_STATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "mojo/services/gfx/composition/cpp/formatting.h" | 13 #include "mojo/services/gfx/composition/cpp/formatting.h" |
| 14 #include "mojo/services/gfx/composition/interfaces/compositor.mojom.h" | 14 #include "mojo/services/gfx/composition/interfaces/compositor.mojom.h" |
| 15 #include "services/gfx/compositor/backend/output.h" | 15 #include "services/gfx/compositor/backend/output.h" |
| 16 #include "services/gfx/compositor/frame_dispatcher.h" |
| 16 #include "services/gfx/compositor/graph/snapshot.h" | 17 #include "services/gfx/compositor/graph/snapshot.h" |
| 17 #include "services/gfx/compositor/scene_state.h" | 18 #include "services/gfx/compositor/scene_state.h" |
| 18 | 19 |
| 19 namespace compositor { | 20 namespace compositor { |
| 20 | 21 |
| 21 // Describes the state of a particular renderer. | 22 // Describes the state of a particular renderer. |
| 22 // This object is owned by the CompositorEngine that created it. | 23 // This object is owned by the CompositorEngine that created it. |
| 23 class RendererState { | 24 class RendererState { |
| 24 public: | 25 public: |
| 25 RendererState(uint32_t id, const std::string& label); | 26 RendererState(uint32_t id, const std::string& label); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // null if none. | 65 // null if none. |
| 65 scoped_refptr<const Snapshot> current_snapshot() const { | 66 scoped_refptr<const Snapshot> current_snapshot() const { |
| 66 return current_snapshot_; | 67 return current_snapshot_; |
| 67 } | 68 } |
| 68 | 69 |
| 69 // Sets the current snapshot, or null if none. | 70 // Sets the current snapshot, or null if none. |
| 70 // Always updates |current_snapshot()|. | 71 // Always updates |current_snapshot()|. |
| 71 // If the snapshot is not blocked, also updates |visible_snapshot()|. | 72 // If the snapshot is not blocked, also updates |visible_snapshot()|. |
| 72 void SetSnapshot(const scoped_refptr<const Snapshot>& snapshot); | 73 void SetSnapshot(const scoped_refptr<const Snapshot>& snapshot); |
| 73 | 74 |
| 75 FrameDispatcher& frame_dispatcher() { return frame_dispatcher_; } |
| 76 |
| 74 const std::string& label() { return label_; } | 77 const std::string& label() { return label_; } |
| 75 std::string FormattedLabel(); | 78 std::string FormattedLabel(); |
| 76 | 79 |
| 77 private: | 80 private: |
| 78 std::unique_ptr<Output> output_; | 81 std::unique_ptr<Output> output_; |
| 79 const uint32_t id_; | 82 const uint32_t id_; |
| 80 const std::string label_; | 83 const std::string label_; |
| 81 std::string formatted_label_cache_; | 84 std::string formatted_label_cache_; |
| 82 | 85 |
| 86 FrameDispatcher frame_dispatcher_; // must be before renderer_impl_ |
| 83 std::unique_ptr<mojo::gfx::composition::Renderer> renderer_impl_; | 87 std::unique_ptr<mojo::gfx::composition::Renderer> renderer_impl_; |
| 84 | 88 |
| 85 SceneState* root_scene_ = nullptr; | 89 SceneState* root_scene_ = nullptr; |
| 86 uint32_t root_scene_version_ = mojo::gfx::composition::kSceneVersionNone; | 90 uint32_t root_scene_version_ = mojo::gfx::composition::kSceneVersionNone; |
| 87 mojo::Rect root_scene_viewport_; | 91 mojo::Rect root_scene_viewport_; |
| 88 | 92 |
| 89 scoped_refptr<const Snapshot> visible_snapshot_; | 93 scoped_refptr<const Snapshot> visible_snapshot_; |
| 90 scoped_refptr<const Snapshot> current_snapshot_; | 94 scoped_refptr<const Snapshot> current_snapshot_; |
| 91 | 95 |
| 92 base::WeakPtrFactory<RendererState> weak_factory_; | 96 base::WeakPtrFactory<RendererState> weak_factory_; |
| 93 | 97 |
| 94 DISALLOW_COPY_AND_ASSIGN(RendererState); | 98 DISALLOW_COPY_AND_ASSIGN(RendererState); |
| 95 }; | 99 }; |
| 96 | 100 |
| 97 std::ostream& operator<<(std::ostream& os, RendererState* renderer_state); | 101 std::ostream& operator<<(std::ostream& os, RendererState* renderer_state); |
| 98 | 102 |
| 99 } // namespace compositor | 103 } // namespace compositor |
| 100 | 104 |
| 101 #endif // SERVICES_GFX_COMPOSITOR_RENDERER_STATE_H_ | 105 #endif // SERVICES_GFX_COMPOSITOR_RENDERER_STATE_H_ |
| OLD | NEW |