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

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

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

Powered by Google App Engine
This is Rietveld 408576698