| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/surfaces/display_impl.h" | 5 #include "components/surfaces/display_impl.h" |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/surfaces/display.h" | 8 #include "cc/surfaces/display.h" |
| 9 #include "components/surfaces/surfaces_context_provider.h" | 9 #include "components/surfaces/surfaces_context_provider.h" |
| 10 #include "components/surfaces/surfaces_output_surface.h" | 10 #include "components/surfaces/surfaces_output_surface.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 viewport_parameter_listener.Pass(), | 39 viewport_parameter_listener.Pass(), |
| 40 base::Bind(&DisplayImpl::OnContextCreated, base::Unretained(this))); | 40 base::Bind(&DisplayImpl::OnContextCreated, base::Unretained(this))); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void DisplayImpl::OnContextCreated(mojo::CommandBufferPtr gles2_client) { | 43 void DisplayImpl::OnContextCreated(mojo::CommandBufferPtr gles2_client) { |
| 44 DCHECK(!display_); | 44 DCHECK(!display_); |
| 45 | 45 |
| 46 cc::RendererSettings settings; | 46 cc::RendererSettings settings; |
| 47 display_.reset(new cc::Display(this, manager_, nullptr, nullptr, settings)); | 47 display_.reset(new cc::Display(this, manager_, nullptr, nullptr, settings)); |
| 48 scheduler_->AddDisplay(display_.get()); | 48 scheduler_->AddDisplay(display_.get()); |
| 49 display_->Initialize(make_scoped_ptr(new surfaces::DirectOutputSurface( | 49 display_->Initialize(make_scoped_ptr( |
| 50 new surfaces::SurfacesContextProvider(gles2_client.PassMessagePipe())))); | 50 new surfaces::DirectOutputSurface(new surfaces::SurfacesContextProvider( |
| 51 gles2_client.PassInterface().PassHandle())))); |
| 51 | 52 |
| 52 factory_.Create(cc_id_); | 53 factory_.Create(cc_id_); |
| 53 display_->SetSurfaceId(cc_id_, 1.f); | 54 display_->SetSurfaceId(cc_id_, 1.f); |
| 54 if (pending_frame_) | 55 if (pending_frame_) |
| 55 Draw(); | 56 Draw(); |
| 56 } | 57 } |
| 57 | 58 |
| 58 DisplayImpl::~DisplayImpl() { | 59 DisplayImpl::~DisplayImpl() { |
| 59 if (display_) { | 60 if (display_) { |
| 60 factory_.Destroy(cc_id_); | 61 factory_.Destroy(cc_id_); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 DCHECK(returner_); | 129 DCHECK(returner_); |
| 129 | 130 |
| 130 mojo::Array<mojo::ReturnedResourcePtr> ret(resources.size()); | 131 mojo::Array<mojo::ReturnedResourcePtr> ret(resources.size()); |
| 131 for (size_t i = 0; i < resources.size(); ++i) { | 132 for (size_t i = 0; i < resources.size(); ++i) { |
| 132 ret[i] = mojo::ReturnedResource::From(resources[i]); | 133 ret[i] = mojo::ReturnedResource::From(resources[i]); |
| 133 } | 134 } |
| 134 returner_->ReturnResources(ret.Pass()); | 135 returner_->ReturnResources(ret.Pass()); |
| 135 } | 136 } |
| 136 | 137 |
| 137 } // namespace surfaces | 138 } // namespace surfaces |
| OLD | NEW |