Chromium Code Reviews| Index: cc/surfaces/surface.h |
| diff --git a/cc/surfaces/surface.h b/cc/surfaces/surface.h |
| index 8ef332ecb79756735b8f6760d23b34d954d973cd..56744ae9e1bdf7304d70e6d0519b5e18b90872f4 100644 |
| --- a/cc/surfaces/surface.h |
| +++ b/cc/surfaces/surface.h |
| @@ -80,6 +80,27 @@ class CC_SURFACES_EXPORT Surface { |
| bool destroyed() const { return destroyed_; } |
| void set_destroyed(bool destroyed) { destroyed_ = destroyed; } |
| + void AddDisplay(Display* display) { |
|
jbauman
2015/09/04 23:58:36
Probably best to use BeginFrameSource* everywhere
|
| + if (!base::ContainsValue(currently_displayed_on_, display)) { |
|
jbauman
2015/09/04 23:58:36
DCHECK this?
|
| + currently_displayed_on_.push_back(display); |
| + factory_->client()->SetBeginFrameSource(surface_id_, static_cast<BeginFrameSource*>(getPrimaryDisplay())); |
|
jbauman
2015/09/04 23:58:36
Be careful, as factory_ can be an invalidated weak
|
| + } |
| + } |
| + |
| + void RemoveDisplay(Display* display) { |
| + DCHECK(base::ContainsValue(current_displayed_on_, display)); |
| + |
| + base::RemoveValue(current_displayed_on_, display); |
| + |
| + factory_->client()->SetBeginFrameSource(surface_id_, static_cast<BeginFrameSource*>(getPrimaryDisplay())); |
| + } |
| + |
| + Display* getPrimaryDisplay() { |
| + if (currently_displayed_on_.empty()) |
| + return NULL; |
| + return current_displayed_on_[0]; |
| + } |
| + |
| private: |
| void ClearCopyRequests(); |
| @@ -91,6 +112,7 @@ class CC_SURFACES_EXPORT Surface { |
| bool destroyed_; |
| std::vector<SurfaceSequence> destruction_dependencies_; |
| + std::vector<Display*> currently_displayed_on_; |
| std::vector<SurfaceId> referenced_surfaces_; |
| DrawCallback draw_callback_; |