Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Unified Diff: cc/surfaces/surface.h

Issue 1304063014: cc: Plumbing for BeginFrameSource based on Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;
« no previous file with comments | « base/stl_util.h ('k') | cc/surfaces/surface.cc » ('j') | cc/surfaces/surface_aggregator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698