| 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/native_viewport/viewport_surface.h" | 5 #include "mojo/services/native_viewport/viewport_surface.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/surfaces/surface_id_allocator.h" | 8 #include "cc/surfaces/surface_id_allocator.h" |
| 9 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" | 9 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" |
| 10 #include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" | 10 #include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 surface_ = surface.Pass(); | 58 surface_ = surface.Pass(); |
| 59 surface_.set_client(this); | 59 surface_.set_client(this); |
| 60 id_allocator_.reset(new cc::SurfaceIdAllocator(id_namespace)); | 60 id_allocator_.reset(new cc::SurfaceIdAllocator(id_namespace)); |
| 61 if (widget_id_ != 0u) | 61 if (widget_id_ != 0u) |
| 62 BindSurfaceToNativeViewport(); | 62 BindSurfaceToNativeViewport(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void ViewportSurface::BindSurfaceToNativeViewport() { | 65 void ViewportSurface::BindSurfaceToNativeViewport() { |
| 66 CommandBufferPtr cb; | 66 CommandBufferPtr cb; |
| 67 gpu_service_->CreateOnscreenGLES2Context( | 67 gpu_service_->CreateOnscreenGLES2Context( |
| 68 widget_id_, Size::From(size_), Get(&cb)); | 68 widget_id_, Size::From(size_), GetProxy(&cb)); |
| 69 | 69 |
| 70 id_ = id_allocator_->GenerateId(); | 70 id_ = id_allocator_->GenerateId(); |
| 71 surface_->CreateGLES2BoundSurface( | 71 surface_->CreateGLES2BoundSurface( |
| 72 cb.Pass(), SurfaceId::From(id_), Size::From(size_)); | 72 cb.Pass(), SurfaceId::From(id_), Size::From(size_)); |
| 73 | 73 |
| 74 SubmitFrame(); | 74 SubmitFrame(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void ViewportSurface::SubmitFrame() { | 77 void ViewportSurface::SubmitFrame() { |
| 78 if (child_id_.is_null() || id_.is_null()) | 78 if (child_id_.is_null() || id_.is_null()) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 102 frame->resources.resize(0u); | 102 frame->resources.resize(0u); |
| 103 surface_->SubmitFrame(SurfaceId::From(id_), frame.Pass()); | 103 surface_->SubmitFrame(SurfaceId::From(id_), frame.Pass()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void ViewportSurface::ReturnResources(Array<ReturnedResourcePtr> resources) { | 106 void ViewportSurface::ReturnResources(Array<ReturnedResourcePtr> resources) { |
| 107 // We never submit resources so we should never get any back. | 107 // We never submit resources so we should never get any back. |
| 108 DCHECK_EQ(0u, resources.size()); | 108 DCHECK_EQ(0u, resources.size()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace mojo | 111 } // namespace mojo |
| OLD | NEW |