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

Side by Side Diff: mojo/cc/output_surface_mojo.cc

Issue 558343004: Compositor bindings for mojo html_viewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo_view_manager_surface
Patch Set: Add missing m/s/p/cpp/v_m -> m/s/p/cpp/surfaces dep in GN Created 6 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 unified diff | Download patch
« no previous file with comments | « mojo/cc/output_surface_mojo.h ('k') | mojo/mojo_services.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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/services/public/cpp/geometry/geometry_type_converters.h" 9 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
10 #include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" 10 #include "mojo/services/public/cpp/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 const scoped_refptr<cc::ContextProvider>& context_provider, 16 const scoped_refptr<cc::ContextProvider>& context_provider,
16 SurfacePtr surface, 17 SurfacePtr surface,
17 uint32_t id_namespace) 18 uint32_t id_namespace)
18 : cc::OutputSurface(context_provider), 19 : cc::OutputSurface(context_provider),
20 output_surface_mojo_client_(client),
19 surface_(surface.Pass()), 21 surface_(surface.Pass()),
20 id_allocator_(id_namespace) { 22 id_allocator_(id_namespace) {
21 surface_.set_client(this); 23 surface_.set_client(this);
24 capabilities_.delegated_rendering = true;
25 capabilities_.max_frames_pending = 1;
22 } 26 }
23 27
24 OutputSurfaceMojo::~OutputSurfaceMojo() { 28 OutputSurfaceMojo::~OutputSurfaceMojo() {
25 } 29 }
26 30
27 void OutputSurfaceMojo::ReturnResources(Array<ReturnedResourcePtr> resources) { 31 void OutputSurfaceMojo::ReturnResources(Array<ReturnedResourcePtr> resources) {
28 } 32 }
29 33
30 void OutputSurfaceMojo::SwapBuffers(cc::CompositorFrame* frame) { 34 void OutputSurfaceMojo::SwapBuffers(cc::CompositorFrame* frame) {
31 gfx::Size frame_size = 35 gfx::Size frame_size =
32 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); 36 frame->delegated_frame_data->render_pass_list.back()->output_rect.size();
33 if (frame_size != surface_size_) { 37 if (frame_size != surface_size_) {
34 if (!surface_id_.is_null()) { 38 if (!surface_id_.is_null()) {
35 surface_->DestroySurface(SurfaceId::From(surface_id_)); 39 surface_->DestroySurface(SurfaceId::From(surface_id_));
36 } 40 }
37 surface_id_ = id_allocator_.GenerateId(); 41 surface_id_ = id_allocator_.GenerateId();
38 surface_->CreateSurface(SurfaceId::From(surface_id_), 42 surface_->CreateSurface(SurfaceId::From(surface_id_),
39 Size::From(frame_size)); 43 Size::From(frame_size));
44 output_surface_mojo_client_->DidCreateSurface(surface_id_);
40 surface_size_ = frame_size; 45 surface_size_ = frame_size;
41 } 46 }
42 47
43 surface_->SubmitFrame(SurfaceId::From(surface_id_), Frame::From(*frame)); 48 surface_->SubmitFrame(SurfaceId::From(surface_id_), Frame::From(*frame));
44 49
45 client_->DidSwapBuffers(); 50 client_->DidSwapBuffers();
46 client_->DidSwapBuffersComplete(); 51 client_->DidSwapBuffersComplete();
47 } 52 }
48 53
49 } // namespace mojo 54 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/cc/output_surface_mojo.h ('k') | mojo/mojo_services.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698