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

Unified Diff: mandoline/ui/aura/surface_binding.cc

Issue 1281663002: Mandoline: Allow submitting CompositorFrames directly to mojo::Views (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yet anther rebase (YAR!!!) Created 5 years, 4 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: mandoline/ui/aura/surface_binding.cc
diff --git a/mandoline/ui/aura/surface_binding.cc b/mandoline/ui/aura/surface_binding.cc
index 0307112933fceeb8ce58269451d00152e885bbbb..5630862bc321f375093d8e30aa8067a227c82f77 100644
--- a/mandoline/ui/aura/surface_binding.cc
+++ b/mandoline/ui/aura/surface_binding.cc
@@ -35,10 +35,7 @@ namespace {
class OutputSurfaceImpl : public cc::OutputSurface {
public:
OutputSurfaceImpl(mojo::View* view,
- const scoped_refptr<cc::ContextProvider>& context_provider,
- mojo::Surface* surface,
- uint32_t id_namespace,
- uint32_t* next_local_id);
+ const scoped_refptr<cc::ContextProvider>& context_provider);
~OutputSurfaceImpl() override;
// cc::OutputSurface:
@@ -46,10 +43,7 @@ class OutputSurfaceImpl : public cc::OutputSurface {
private:
mojo::View* view_;
- mojo::Surface* surface_;
- uint32_t id_namespace_;
- uint32_t* next_local_id_; // Owned by PerViewManagerState.
- uint32_t local_id_;
+ mojo::CompositorFrameReceiverPtr receiver_;
gfx::Size surface_size_;
DISALLOW_COPY_AND_ASSIGN(OutputSurfaceImpl);
@@ -57,41 +51,20 @@ class OutputSurfaceImpl : public cc::OutputSurface {
OutputSurfaceImpl::OutputSurfaceImpl(
mojo::View* view,
- const scoped_refptr<cc::ContextProvider>& context_provider,
- mojo::Surface* surface,
- uint32_t id_namespace,
- uint32_t* next_local_id)
+ const scoped_refptr<cc::ContextProvider>& context_provider)
: cc::OutputSurface(context_provider),
- view_(view),
- surface_(surface),
- id_namespace_(id_namespace),
- next_local_id_(next_local_id),
- local_id_(0u) {
+ view_(view) {
capabilities_.delegated_rendering = true;
capabilities_.max_frames_pending = 1;
+ view->RequestCompositorFrameReceiver(GetProxy(&receiver_));
}
OutputSurfaceImpl::~OutputSurfaceImpl() {
}
void OutputSurfaceImpl::SwapBuffers(cc::CompositorFrame* frame) {
- gfx::Size frame_size =
- frame->delegated_frame_data->render_pass_list.back()->output_rect.size();
- if (frame_size != surface_size_) {
- if (local_id_ != 0u)
- surface_->DestroySurface(local_id_);
- local_id_ = (*next_local_id_)++;
- surface_->CreateSurface(local_id_);
- auto qualified_id = mojo::SurfaceId::New();
- qualified_id->local = local_id_;
- qualified_id->id_namespace = id_namespace_;
- view_->SetSurfaceId(qualified_id.Pass());
- surface_size_ = frame_size;
- }
-
- surface_->SubmitFrame(local_id_,
- mojo::CompositorFrame::From(*frame),
- mojo::Closure());
+ receiver_->SubmitCompositorFrame(mojo::CompositorFrame::From(*frame),
+ mojo::Closure());
rjkroege 2015/08/19 23:45:44 are you correctly interlocking?
Fady Samuel 2015/08/20 16:22:44 I'm not sure what you mean here. We submit frames
client_->DidSwapBuffers();
client_->DidSwapBuffersComplete();
@@ -177,8 +150,7 @@ SurfaceBinding::PerViewManagerState::CreateOutputSurface(mojo::View* view) {
gpu_->CreateOffscreenGLES2Context(GetProxy(&cb));
scoped_refptr<cc::ContextProvider> context_provider(
new mojo::ContextProviderMojo(cb.PassInterface().PassHandle()));
- return make_scoped_ptr(new OutputSurfaceImpl(
- view, context_provider, surface_.get(), id_namespace_, &next_local_id_));
+ return make_scoped_ptr(new OutputSurfaceImpl(view, context_provider));
}
SurfaceBinding::PerViewManagerState::PerViewManagerState(

Powered by Google App Engine
This is Rietveld 408576698