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/context_provider_mojo.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" |
11 #include "components/surfaces/surfaces_scheduler.h" | 11 #include "components/surfaces/surfaces_scheduler.h" |
12 #include "mojo/converters/geometry/geometry_type_converters.h" | 12 #include "mojo/converters/geometry/geometry_type_converters.h" |
13 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 13 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
14 | 14 |
15 namespace surfaces { | 15 namespace surfaces { |
16 namespace { | 16 namespace { |
17 void CallCallback(const mojo::Closure& callback, cc::SurfaceDrawStatus status) { | 17 void CallCallback(const mojo::Closure& callback, cc::SurfaceDrawStatus status) { |
18 callback.Run(); | 18 callback.Run(); |
19 } | 19 } |
(...skipping 19 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 mojo::DirectOutputSurface( | 49 display_->Initialize(make_scoped_ptr(new surfaces::DirectOutputSurface( |
50 new mojo::ContextProviderMojo(gles2_client.PassMessagePipe())))); | 50 new surfaces::SurfacesContextProvider(gles2_client.PassMessagePipe())))); |
51 | 51 |
52 factory_.Create(cc_id_); | 52 factory_.Create(cc_id_); |
53 display_->SetSurfaceId(cc_id_, 1.f); | 53 display_->SetSurfaceId(cc_id_, 1.f); |
54 if (pending_frame_) | 54 if (pending_frame_) |
55 Draw(); | 55 Draw(); |
56 } | 56 } |
57 | 57 |
58 DisplayImpl::~DisplayImpl() { | 58 DisplayImpl::~DisplayImpl() { |
59 if (display_) { | 59 if (display_) { |
60 factory_.Destroy(cc_id_); | 60 factory_.Destroy(cc_id_); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 DCHECK(returner_); | 128 DCHECK(returner_); |
129 | 129 |
130 mojo::Array<mojo::ReturnedResourcePtr> ret(resources.size()); | 130 mojo::Array<mojo::ReturnedResourcePtr> ret(resources.size()); |
131 for (size_t i = 0; i < resources.size(); ++i) { | 131 for (size_t i = 0; i < resources.size(); ++i) { |
132 ret[i] = mojo::ReturnedResource::From(resources[i]); | 132 ret[i] = mojo::ReturnedResource::From(resources[i]); |
133 } | 133 } |
134 returner_->ReturnResources(ret.Pass()); | 134 returner_->ReturnResources(ret.Pass()); |
135 } | 135 } |
136 | 136 |
137 } // namespace surfaces | 137 } // namespace surfaces |
OLD | NEW |