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

Side by Side Diff: mojo/services/surfaces/surfaces_impl.cc

Issue 687433002: Remove mojo/shell and (most) service implementations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove mojo/gles2, disable mojo apps in component build Created 6 years, 1 month 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/services/surfaces/surfaces_impl.h"
6
7 #include "cc/output/compositor_frame.h"
8 #include "cc/resources/returned_resource.h"
9 #include "cc/surfaces/display.h"
10 #include "cc/surfaces/surface_id_allocator.h"
11 #include "mojo/cc/context_provider_mojo.h"
12 #include "mojo/cc/direct_output_surface.h"
13 #include "mojo/converters/geometry/geometry_type_converters.h"
14 #include "mojo/converters/surfaces/surfaces_type_converters.h"
15
16 namespace mojo {
17
18 SurfacesImpl::SurfacesImpl(cc::SurfaceManager* manager,
19 uint32_t id_namespace,
20 Client* client)
21 : manager_(manager),
22 factory_(manager, this),
23 id_namespace_(id_namespace),
24 client_(client) {
25 }
26
27 SurfacesImpl::~SurfacesImpl() {
28 }
29
30 void SurfacesImpl::CreateSurface(SurfaceIdPtr id, mojo::SizePtr size) {
31 cc::SurfaceId cc_id = id.To<cc::SurfaceId>();
32 if (cc::SurfaceIdAllocator::NamespaceForId(cc_id) != id_namespace_) {
33 // Bad message, do something bad to the caller?
34 NOTREACHED();
35 return;
36 }
37 factory_.Create(id.To<cc::SurfaceId>(), size.To<gfx::Size>());
38 }
39
40 void SurfacesImpl::SubmitFrame(SurfaceIdPtr id, FramePtr frame_ptr) {
41 cc::SurfaceId cc_id = id.To<cc::SurfaceId>();
42 if (cc::SurfaceIdAllocator::NamespaceForId(cc_id) != id_namespace_) {
43 // Bad message, do something bad to the caller?
44 LOG(FATAL) << "Received frame for id " << cc_id.id << " namespace "
45 << cc::SurfaceIdAllocator::NamespaceForId(cc_id)
46 << " should be namespace " << id_namespace_;
47 return;
48 }
49 factory_.SubmitFrame(id.To<cc::SurfaceId>(),
50 frame_ptr.To<scoped_ptr<cc::CompositorFrame> >(),
51 base::Closure());
52 client_->FrameSubmitted();
53 }
54
55 void SurfacesImpl::DestroySurface(SurfaceIdPtr id) {
56 cc::SurfaceId cc_id = id.To<cc::SurfaceId>();
57 if (cc::SurfaceIdAllocator::NamespaceForId(cc_id) != id_namespace_) {
58 // Bad message, do something bad to the caller?
59 NOTREACHED();
60 return;
61 }
62 factory_.Destroy(id.To<cc::SurfaceId>());
63 }
64
65 void SurfacesImpl::CreateGLES2BoundSurface(CommandBufferPtr gles2_client,
66 SurfaceIdPtr id,
67 mojo::SizePtr size) {
68 command_buffer_handle_ = gles2_client.PassMessagePipe();
69
70 cc::SurfaceId cc_id = id.To<cc::SurfaceId>();
71 if (cc::SurfaceIdAllocator::NamespaceForId(cc_id) != id_namespace_) {
72 // Bad message, do something bad to the caller?
73 LOG(FATAL) << "Received request for id " << cc_id.id << " namespace "
74 << cc::SurfaceIdAllocator::NamespaceForId(cc_id)
75 << " should be namespace " << id_namespace_;
76 return;
77 }
78 if (!display_) {
79 display_.reset(new cc::Display(this, manager_, NULL, NULL));
80 client_->SetDisplay(display_.get());
81 display_->Initialize(make_scoped_ptr(new DirectOutputSurface(
82 new ContextProviderMojo(command_buffer_handle_.Pass()))));
83 }
84 factory_.Create(cc_id, size.To<gfx::Size>());
85 display_->Resize(cc_id, size.To<gfx::Size>());
86 }
87
88 void SurfacesImpl::ReturnResources(const cc::ReturnedResourceArray& resources) {
89 Array<ReturnedResourcePtr> ret(resources.size());
90 for (size_t i = 0; i < resources.size(); ++i) {
91 ret[i] = ReturnedResource::From(resources[i]);
92 }
93 client()->ReturnResources(ret.Pass());
94 }
95
96 void SurfacesImpl::DisplayDamaged() {
97 }
98
99 void SurfacesImpl::DidSwapBuffers() {
100 }
101
102 void SurfacesImpl::DidSwapBuffersComplete() {
103 }
104
105 void SurfacesImpl::CommitVSyncParameters(base::TimeTicks timebase,
106 base::TimeDelta interval) {
107 }
108
109 void SurfacesImpl::OutputSurfaceLost() {
110 }
111
112 void SurfacesImpl::SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) {
113 }
114
115 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/surfaces/surfaces_impl.h ('k') | mojo/services/surfaces/surfaces_service_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698