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

Unified Diff: cc/surfaces/surface_factory.cc

Issue 1304063014: cc: Plumbing for BeginFrameSource based on Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More use-after-free. Attempt to fix mojo. 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_factory.cc
diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc
index 3e83c8cfd7341c57485af26fbcc9873e8b2beb51..6cc9d4938cecd2e4e14ca15325d73455cee418fa 100644
--- a/cc/surfaces/surface_factory.cc
+++ b/cc/surfaces/surface_factory.cc
@@ -8,6 +8,7 @@
#include "cc/output/compositor_frame.h"
#include "cc/output/copy_output_request.h"
#include "cc/surfaces/surface.h"
+#include "cc/surfaces/surface_factory_client.h"
#include "cc/surfaces/surface_manager.h"
#include "ui/gfx/geometry/size.h"
@@ -26,6 +27,7 @@ SurfaceFactory::~SurfaceFactory() {
<< " entries in map on destruction.";
}
DestroyAll();
+ client_->SetBeginFrameSource(nullptr);
}
void SurfaceFactory::DestroyAll() {
@@ -39,6 +41,7 @@ void SurfaceFactory::Create(SurfaceId surface_id) {
manager_->RegisterSurface(surface.get());
DCHECK(!surface_map_.count(surface_id));
surface_map_.add(surface_id, surface.Pass());
+ most_recently_created_surface_id_ = surface_id;
}
void SurfaceFactory::Destroy(SurfaceId surface_id) {
@@ -48,6 +51,14 @@ void SurfaceFactory::Destroy(SurfaceId surface_id) {
manager_->Destroy(surface_map_.take_and_erase(it));
}
+void SurfaceFactory::SetBeginFrameSource(SurfaceId surface_id,
+ BeginFrameSource* begin_frame_source) {
+ if (most_recently_created_surface_id_ != surface_id)
mithro-old 2015/10/01 03:00:24 nit: Can you add a comment about why this check is
brianderson 2015/10/07 20:54:48 Done.
+ return;
+
+ client_->SetBeginFrameSource(begin_frame_source);
+}
+
void SurfaceFactory::SubmitCompositorFrame(SurfaceId surface_id,
scoped_ptr<CompositorFrame> frame,
const DrawCallback& callback) {

Powered by Google App Engine
This is Rietveld 408576698