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 #include "services/gfx/compositor/renderer_state.h" | 5 #include "services/gfx/compositor/renderer_state.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 | 9 |
10 namespace compositor { | 10 namespace compositor { |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 bool RendererState::ResetRootScene() { | 33 bool RendererState::ResetRootScene() { |
34 if (root_scene_) { | 34 if (root_scene_) { |
35 root_scene_ = nullptr; | 35 root_scene_ = nullptr; |
36 SetSnapshot(nullptr); | 36 SetSnapshot(nullptr); |
37 return true; | 37 return true; |
38 } | 38 } |
39 return false; | 39 return false; |
40 } | 40 } |
41 | 41 |
42 bool RendererState::SetSnapshot(std::unique_ptr<Snapshot> snapshot) { | 42 void RendererState::SetSnapshot(const scoped_refptr<const Snapshot>& snapshot) { |
43 snapshot_ = std::move(snapshot); | 43 current_snapshot_ = snapshot; |
44 if (snapshot_ && snapshot_->valid()) { | 44 if (current_snapshot_ && !current_snapshot_->is_blocked()) |
45 frame_ = snapshot_->frame(); | 45 visible_snapshot_ = current_snapshot_; |
46 DCHECK(frame_); | |
47 return true; | |
48 } | |
49 return false; | |
50 } | 46 } |
51 | 47 |
52 std::string RendererState::FormattedLabel() { | 48 std::string RendererState::FormattedLabel() { |
53 if (formatted_label_cache_.empty()) { | 49 if (formatted_label_cache_.empty()) { |
54 formatted_label_cache_ = | 50 formatted_label_cache_ = |
55 label_.empty() ? base::StringPrintf("<%d>", id_) | 51 label_.empty() ? base::StringPrintf("<%d>", id_) |
56 : base::StringPrintf("<%d:%s>", id_, label_.c_str()); | 52 : base::StringPrintf("<%d:%s>", id_, label_.c_str()); |
57 } | 53 } |
58 return formatted_label_cache_; | 54 return formatted_label_cache_; |
59 } | 55 } |
60 | 56 |
61 std::ostream& operator<<(std::ostream& os, RendererState* renderer_state) { | 57 std::ostream& operator<<(std::ostream& os, RendererState* renderer_state) { |
62 if (!renderer_state) | 58 if (!renderer_state) |
63 return os << "null"; | 59 return os << "null"; |
64 return os << renderer_state->FormattedLabel(); | 60 return os << renderer_state->FormattedLabel(); |
65 } | 61 } |
66 | 62 |
67 } // namespace compositor | 63 } // namespace compositor |
OLD | NEW |