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

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

Issue 904103003: Update mojo sdk to rev 8d45c89c30b230843c5bd6dd0693a555750946c0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: surfaces_service.mojom.h -> surfaces.mojom.h Created 5 years, 10 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/services/html_viewer/html_document.cc » ('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 "base/bind.h"
7 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
8 #include "cc/output/output_surface_client.h" 9 #include "cc/output/output_surface_client.h"
9 #include "mojo/converters/geometry/geometry_type_converters.h" 10 #include "mojo/converters/geometry/geometry_type_converters.h"
10 #include "mojo/converters/surfaces/surfaces_type_converters.h" 11 #include "mojo/converters/surfaces/surfaces_type_converters.h"
11 12
12 namespace mojo { 13 namespace mojo {
13 14
14 OutputSurfaceMojo::OutputSurfaceMojo( 15 OutputSurfaceMojo::OutputSurfaceMojo(
15 OutputSurfaceMojoClient* client, 16 OutputSurfaceMojoClient* client,
16 const scoped_refptr<cc::ContextProvider>& context_provider, 17 const scoped_refptr<cc::ContextProvider>& context_provider,
17 SurfacePtr surface) 18 SurfacePtr surface)
18 : cc::OutputSurface(context_provider), 19 : cc::OutputSurface(context_provider),
19 output_surface_mojo_client_(client), 20 output_surface_mojo_client_(client),
20 surface_(surface.Pass()), 21 surface_(surface.Pass()),
21 id_namespace_(0u), 22 id_namespace_(0u),
22 local_id_(0u) { 23 local_id_(0u) {
24 surface_->GetIdNamespace(
25 base::Bind(&OutputSurfaceMojo::SetIdNamespace, base::Unretained(this)));
23 capabilities_.delegated_rendering = true; 26 capabilities_.delegated_rendering = true;
24 capabilities_.max_frames_pending = 1; 27 capabilities_.max_frames_pending = 1;
25 } 28 }
26 29
27 OutputSurfaceMojo::~OutputSurfaceMojo() { 30 OutputSurfaceMojo::~OutputSurfaceMojo() {
28 } 31 }
29 32
30 void OutputSurfaceMojo::SetIdNamespace(uint32_t id_namespace) { 33 void OutputSurfaceMojo::SetIdNamespace(uint32_t id_namespace) {
31 id_namespace_ = id_namespace; 34 id_namespace_ = id_namespace;
32 if (local_id_) { 35 if (local_id_) {
33 cc::SurfaceId qualified_id(static_cast<uint64_t>(id_namespace_) << 32 | 36 cc::SurfaceId qualified_id(static_cast<uint64_t>(id_namespace_) << 32 |
34 local_id_); 37 local_id_);
35 output_surface_mojo_client_->DidCreateSurface(qualified_id); 38 output_surface_mojo_client_->DidCreateSurface(qualified_id);
36 } 39 }
37 } 40 }
38 41
39 void OutputSurfaceMojo::ReturnResources(Array<ReturnedResourcePtr> resources) {
40 }
41
42 bool OutputSurfaceMojo::BindToClient(cc::OutputSurfaceClient* client) { 42 bool OutputSurfaceMojo::BindToClient(cc::OutputSurfaceClient* client) {
43 surface_.set_client(this);
44 return cc::OutputSurface::BindToClient(client); 43 return cc::OutputSurface::BindToClient(client);
45 } 44 }
46 45
47 void OutputSurfaceMojo::SwapBuffers(cc::CompositorFrame* frame) { 46 void OutputSurfaceMojo::SwapBuffers(cc::CompositorFrame* frame) {
48 gfx::Size frame_size = 47 gfx::Size frame_size =
49 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); 48 frame->delegated_frame_data->render_pass_list.back()->output_rect.size();
50 if (frame_size != surface_size_) { 49 if (frame_size != surface_size_) {
51 if (local_id_ != 0u) { 50 if (local_id_ != 0u) {
52 surface_->DestroySurface(local_id_); 51 surface_->DestroySurface(local_id_);
53 } 52 }
54 local_id_++; 53 local_id_++;
55 surface_->CreateSurface(local_id_); 54 surface_->CreateSurface(local_id_);
56 if (id_namespace_) { 55 if (id_namespace_) {
57 cc::SurfaceId qualified_id(static_cast<uint64_t>(id_namespace_) << 32 | 56 cc::SurfaceId qualified_id(static_cast<uint64_t>(id_namespace_) << 32 |
58 local_id_); 57 local_id_);
59 output_surface_mojo_client_->DidCreateSurface(qualified_id); 58 output_surface_mojo_client_->DidCreateSurface(qualified_id);
60 } 59 }
61 surface_size_ = frame_size; 60 surface_size_ = frame_size;
62 } 61 }
63 62
64 surface_->SubmitFrame(local_id_, Frame::From(*frame), mojo::Closure()); 63 surface_->SubmitFrame(local_id_, Frame::From(*frame), mojo::Closure());
65 64
66 client_->DidSwapBuffers(); 65 client_->DidSwapBuffers();
67 client_->DidSwapBuffersComplete(); 66 client_->DidSwapBuffersComplete();
68 } 67 }
69 68
70 } // namespace mojo 69 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/cc/output_surface_mojo.h ('k') | mojo/services/html_viewer/html_document.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698