Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "mojo/cc/output_surface_mojo.h" | 5 #include "mojo/cc/output_surface_mojo.h" |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/output/output_surface_client.h" | 8 #include "cc/output/output_surface_client.h" |
| 9 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 10 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 10 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
| 11 | 11 |
| 12 namespace mojo { | 12 namespace mojo { |
| 13 | 13 |
| 14 OutputSurfaceMojo::OutputSurfaceMojo( | 14 OutputSurfaceMojo::OutputSurfaceMojo( |
| 15 OutputSurfaceMojoClient* client, | 15 OutputSurfaceMojoClient* client, |
| 16 const scoped_refptr<cc::ContextProvider>& context_provider, | 16 const scoped_refptr<cc::ContextProvider>& context_provider, |
| 17 SurfacePtr surface, | 17 SurfacePtr surface, |
| 18 uint32_t id_namespace) | 18 uint32_t id_namespace) |
| 19 : cc::OutputSurface(context_provider), | 19 : cc::OutputSurface(context_provider), |
| 20 output_surface_mojo_client_(client), | 20 output_surface_mojo_client_(client), |
| 21 surface_(surface.Pass()), | 21 surface_(surface.Pass()), |
| 22 id_allocator_(id_namespace) { | 22 id_allocator_(id_namespace) { |
| 23 capabilities_.delegated_rendering = true; | 23 capabilities_.delegated_rendering = true; |
| 24 capabilities_.max_frames_pending = 1; | 24 capabilities_.max_frames_pending = 1; |
| 25 } | 25 } |
| 26 | 26 |
| 27 OutputSurfaceMojo::~OutputSurfaceMojo() { | 27 OutputSurfaceMojo::~OutputSurfaceMojo() { |
| 28 if (!surface_id_.is_null()) | |
| 29 surface_->DestroySurface(SurfaceId::From(surface_id_)); | |
|
eseidel
2014/11/05 18:27:08
My understanding is that this is necessary based o
| |
| 28 } | 30 } |
| 29 | 31 |
| 30 void OutputSurfaceMojo::ReturnResources(Array<ReturnedResourcePtr> resources) { | 32 void OutputSurfaceMojo::ReturnResources(Array<ReturnedResourcePtr> resources) { |
| 31 } | 33 } |
| 32 | 34 |
| 33 bool OutputSurfaceMojo::BindToClient(cc::OutputSurfaceClient* client) { | 35 bool OutputSurfaceMojo::BindToClient(cc::OutputSurfaceClient* client) { |
| 34 surface_.set_client(this); | 36 surface_.set_client(this); |
| 35 return cc::OutputSurface::BindToClient(client); | 37 return cc::OutputSurface::BindToClient(client); |
| 36 } | 38 } |
| 37 | 39 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 49 surface_size_ = frame_size; | 51 surface_size_ = frame_size; |
| 50 } | 52 } |
| 51 | 53 |
| 52 surface_->SubmitFrame(SurfaceId::From(surface_id_), Frame::From(*frame)); | 54 surface_->SubmitFrame(SurfaceId::From(surface_id_), Frame::From(*frame)); |
| 53 | 55 |
| 54 client_->DidSwapBuffers(); | 56 client_->DidSwapBuffers(); |
| 55 client_->DidSwapBuffersComplete(); | 57 client_->DidSwapBuffersComplete(); |
| 56 } | 58 } |
| 57 | 59 |
| 58 } // namespace mojo | 60 } // namespace mojo |
| OLD | NEW |