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

Side by Side Diff: sky/compositor/surface_holder.cc

Issue 756673004: Surfaces should acknowledge frame submissions (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sky/compositor/surface_holder.h" 5 #include "sky/compositor/surface_holder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "mojo/converters/geometry/geometry_type_converters.h" 9 #include "mojo/converters/geometry/geometry_type_converters.h"
10 #include "mojo/public/cpp/application/connect.h" 10 #include "mojo/public/cpp/application/connect.h"
(...skipping 18 matching lines...) Expand all
29 29
30 SurfaceHolder::~SurfaceHolder() { 30 SurfaceHolder::~SurfaceHolder() {
31 if (surface_ && surface_id_) 31 if (surface_ && surface_id_)
32 surface_->DestroySurface(surface_id_.Clone()); 32 surface_->DestroySurface(surface_id_.Clone());
33 } 33 }
34 34
35 bool SurfaceHolder::IsReadyForFrame() const { 35 bool SurfaceHolder::IsReadyForFrame() const {
36 return surface_; 36 return surface_;
37 } 37 }
38 38
39 void SurfaceHolder::SubmitFrame(mojo::FramePtr frame) { 39 void SurfaceHolder::SubmitFrame(mojo::FramePtr frame,
40 surface_->SubmitFrame(surface_id_.Clone(), frame.Pass()); 40 const base::Closure& callback) {
41 surface_->SubmitFrame(surface_id_.Clone(), frame.Pass(), callback);
41 } 42 }
42 43
43 void SurfaceHolder::SetSize(const gfx::Size& size) { 44 void SurfaceHolder::SetSize(const gfx::Size& size) {
44 if (surface_id_ && size_ == size) 45 if (surface_id_ && size_ == size)
45 return; 46 return;
46 47
47 if (surface_id_) { 48 if (surface_id_) {
48 surface_->DestroySurface(surface_id_.Clone()); 49 surface_->DestroySurface(surface_id_.Clone());
49 } else { 50 } else {
50 surface_id_ = mojo::SurfaceId::New(); 51 surface_id_ = mojo::SurfaceId::New();
(...skipping 12 matching lines...) Expand all
63 if (!resources.size()) 64 if (!resources.size())
64 return; 65 return;
65 client_->ReturnResources(resources.Pass()); 66 client_->ReturnResources(resources.Pass());
66 } 67 }
67 68
68 void SurfaceHolder::OnSurfaceConnectionCreated(mojo::SurfacePtr surface, 69 void SurfaceHolder::OnSurfaceConnectionCreated(mojo::SurfacePtr surface,
69 uint32_t id_namespace) { 70 uint32_t id_namespace) {
70 surface_ = surface.Pass(); 71 surface_ = surface.Pass();
71 surface_.set_client(this); 72 surface_.set_client(this);
72 surface_allocator_.reset(new SurfaceAllocator(id_namespace)); 73 surface_allocator_.reset(new SurfaceAllocator(id_namespace));
74 client_->OnSurfaceConnectionCreated();
73 } 75 }
74 76
75 } // namespace sky 77 } // namespace sky
OLDNEW
« mojo/services/public/interfaces/surfaces/surfaces.mojom ('K') | « sky/compositor/surface_holder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698