| 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/aura/surface_binding.h" | 5 #include "mojo/aura/surface_binding.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 // SurfaceclientImpl ----------------------------------------------------------- | 33 // SurfaceclientImpl ----------------------------------------------------------- |
| 34 | 34 |
| 35 class SurfaceClientImpl : public SurfaceClient { | 35 class SurfaceClientImpl : public SurfaceClient { |
| 36 public: | 36 public: |
| 37 SurfaceClientImpl() {} | 37 SurfaceClientImpl() {} |
| 38 ~SurfaceClientImpl() override {} | 38 ~SurfaceClientImpl() override {} |
| 39 | 39 |
| 40 // SurfaceClient: | 40 // SurfaceClient: |
| 41 void SetIdNamespace(uint32_t id_namespace) override {} |
| 41 void ReturnResources(Array<ReturnedResourcePtr> resources) override { | 42 void ReturnResources(Array<ReturnedResourcePtr> resources) override { |
| 42 // TODO (sky|jamesr): figure out right way to recycle resources. | 43 // TODO (sky|jamesr): figure out right way to recycle resources. |
| 43 } | 44 } |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 DISALLOW_COPY_AND_ASSIGN(SurfaceClientImpl); | 47 DISALLOW_COPY_AND_ASSIGN(SurfaceClientImpl); |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 // OutputSurface --------------------------------------------------------------- | 50 // OutputSurface --------------------------------------------------------------- |
| 50 | 51 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 OutputSurfaceImpl::~OutputSurfaceImpl() { | 88 OutputSurfaceImpl::~OutputSurfaceImpl() { |
| 88 } | 89 } |
| 89 | 90 |
| 90 void OutputSurfaceImpl::SwapBuffers(cc::CompositorFrame* frame) { | 91 void OutputSurfaceImpl::SwapBuffers(cc::CompositorFrame* frame) { |
| 91 gfx::Size frame_size = | 92 gfx::Size frame_size = |
| 92 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); | 93 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); |
| 93 if (frame_size != surface_size_) { | 94 if (frame_size != surface_size_) { |
| 94 if (!surface_id_.is_null()) | 95 if (!surface_id_.is_null()) |
| 95 surface_->DestroySurface(SurfaceId::From(surface_id_)); | 96 surface_->DestroySurface(SurfaceId::From(surface_id_)); |
| 96 surface_id_ = id_allocator_->GenerateId(); | 97 surface_id_ = id_allocator_->GenerateId(); |
| 97 surface_->CreateSurface(SurfaceId::From(surface_id_), | 98 surface_->CreateSurface(SurfaceId::From(surface_id_)); |
| 98 Size::From(frame_size)); | |
| 99 view_->SetSurfaceId(SurfaceId::From(surface_id_)); | 99 view_->SetSurfaceId(SurfaceId::From(surface_id_)); |
| 100 surface_size_ = frame_size; | 100 surface_size_ = frame_size; |
| 101 } | 101 } |
| 102 | 102 |
| 103 surface_->SubmitFrame(SurfaceId::From(surface_id_), Frame::From(*frame), | 103 surface_->SubmitFrame(SurfaceId::From(surface_id_), Frame::From(*frame), |
| 104 mojo::Closure()); | 104 mojo::Closure()); |
| 105 | 105 |
| 106 client_->DidSwapBuffers(); | 106 client_->DidSwapBuffers(); |
| 107 client_->DidSwapBuffersComplete(); | 107 client_->DidSwapBuffersComplete(); |
| 108 } | 108 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 } | 243 } |
| 244 | 244 |
| 245 SurfaceBinding::~SurfaceBinding() { | 245 SurfaceBinding::~SurfaceBinding() { |
| 246 } | 246 } |
| 247 | 247 |
| 248 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { | 248 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { |
| 249 return state_->CreateOutputSurface(view_); | 249 return state_->CreateOutputSurface(view_); |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace mojo | 252 } // namespace mojo |
| OLD | NEW |