| 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/services/surfaces/surfaces_impl.h" | 5 #include "mojo/services/surfaces/surfaces_impl.h" |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/resources/returned_resource.h" | 8 #include "cc/resources/returned_resource.h" |
| 9 #include "cc/surfaces/display.h" | 9 #include "cc/surfaces/display.h" |
| 10 #include "cc/surfaces/surface_id_allocator.h" | 10 #include "cc/surfaces/surface_id_allocator.h" |
| 11 #include "mojo/cc/context_provider_mojo.h" | 11 #include "mojo/cc/context_provider_mojo.h" |
| 12 #include "mojo/cc/direct_output_surface.h" | 12 #include "mojo/cc/direct_output_surface.h" |
| 13 #include "mojo/converters/geometry/geometry_type_converters.h" | 13 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 14 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 14 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
| 15 | 15 |
| 16 namespace mojo { | 16 namespace mojo { |
| 17 | 17 |
| 18 SurfacesImpl::SurfacesImpl(cc::SurfaceManager* manager, | 18 SurfacesImpl::SurfacesImpl(cc::SurfaceManager* manager, |
| 19 uint32_t id_namespace, | 19 uint32_t id_namespace, |
| 20 Client* client) | 20 Client* client, |
| 21 SurfacePtr* surface) |
| 21 : manager_(manager), | 22 : manager_(manager), |
| 22 factory_(manager, this), | 23 factory_(manager, this), |
| 23 id_namespace_(id_namespace), | 24 id_namespace_(id_namespace), |
| 24 client_(client) { | 25 client_(client), |
| 26 binding_(this, surface) { |
| 25 } | 27 } |
| 26 | 28 |
| 27 SurfacesImpl::~SurfacesImpl() { | 29 SurfacesImpl::~SurfacesImpl() { |
| 28 client_->OnDisplayBeingDestroyed(display_.get()); | 30 client_->OnDisplayBeingDestroyed(display_.get()); |
| 29 factory_.DestroyAll(); | 31 factory_.DestroyAll(); |
| 30 } | 32 } |
| 31 | 33 |
| 32 void SurfacesImpl::CreateSurface(SurfaceIdPtr id, mojo::SizePtr size) { | 34 void SurfacesImpl::CreateSurface(SurfaceIdPtr id, mojo::SizePtr size) { |
| 33 cc::SurfaceId cc_id = id.To<cc::SurfaceId>(); | 35 cc::SurfaceId cc_id = id.To<cc::SurfaceId>(); |
| 34 if (cc::SurfaceIdAllocator::NamespaceForId(cc_id) != id_namespace_) { | 36 if (cc::SurfaceIdAllocator::NamespaceForId(cc_id) != id_namespace_) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 87 } |
| 86 factory_.Create(cc_id, size.To<gfx::Size>()); | 88 factory_.Create(cc_id, size.To<gfx::Size>()); |
| 87 display_->Resize(cc_id, size.To<gfx::Size>(), 1.f); | 89 display_->Resize(cc_id, size.To<gfx::Size>(), 1.f); |
| 88 } | 90 } |
| 89 | 91 |
| 90 void SurfacesImpl::ReturnResources(const cc::ReturnedResourceArray& resources) { | 92 void SurfacesImpl::ReturnResources(const cc::ReturnedResourceArray& resources) { |
| 91 Array<ReturnedResourcePtr> ret(resources.size()); | 93 Array<ReturnedResourcePtr> ret(resources.size()); |
| 92 for (size_t i = 0; i < resources.size(); ++i) { | 94 for (size_t i = 0; i < resources.size(); ++i) { |
| 93 ret[i] = ReturnedResource::From(resources[i]); | 95 ret[i] = ReturnedResource::From(resources[i]); |
| 94 } | 96 } |
| 95 client()->ReturnResources(ret.Pass()); | 97 binding_.client()->ReturnResources(ret.Pass()); |
| 96 } | 98 } |
| 97 | 99 |
| 98 void SurfacesImpl::DisplayDamaged() { | 100 void SurfacesImpl::DisplayDamaged() { |
| 99 } | 101 } |
| 100 | 102 |
| 101 void SurfacesImpl::DidSwapBuffers() { | 103 void SurfacesImpl::DidSwapBuffers() { |
| 102 } | 104 } |
| 103 | 105 |
| 104 void SurfacesImpl::DidSwapBuffersComplete() { | 106 void SurfacesImpl::DidSwapBuffersComplete() { |
| 105 } | 107 } |
| 106 | 108 |
| 107 void SurfacesImpl::CommitVSyncParameters(base::TimeTicks timebase, | 109 void SurfacesImpl::CommitVSyncParameters(base::TimeTicks timebase, |
| 108 base::TimeDelta interval) { | 110 base::TimeDelta interval) { |
| 109 } | 111 } |
| 110 | 112 |
| 111 void SurfacesImpl::OutputSurfaceLost() { | 113 void SurfacesImpl::OutputSurfaceLost() { |
| 112 } | 114 } |
| 113 | 115 |
| 114 void SurfacesImpl::SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) { | 116 void SurfacesImpl::SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) { |
| 115 } | 117 } |
| 116 | 118 |
| 117 } // namespace mojo | 119 } // namespace mojo |
| OLD | NEW |