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/mus/surfaces/top_level_display_client.h" | 5 #include "components/mus/surfaces/top_level_display_client.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/mus/gles2/gpu_state.h" | 9 #include "components/mus/gles2/gpu_state.h" |
10 #include "components/mus/surfaces/surfaces_context_provider.h" | 10 #include "components/mus/surfaces/surfaces_context_provider.h" |
11 #include "components/mus/surfaces/surfaces_output_surface.h" | 11 #include "components/mus/surfaces/surfaces_output_surface.h" |
12 #include "components/mus/surfaces/surfaces_scheduler.h" | 12 #include "components/mus/surfaces/surfaces_scheduler.h" |
13 #include "components/mus/surfaces/surfaces_state.h" | 13 #include "components/mus/surfaces/surfaces_state.h" |
14 | 14 |
15 namespace surfaces { | 15 namespace mus { |
16 namespace { | 16 namespace { |
17 void CallCallback(const base::Closure& callback, cc::SurfaceDrawStatus status) { | 17 void CallCallback(const base::Closure& callback, cc::SurfaceDrawStatus status) { |
18 callback.Run(); | 18 callback.Run(); |
19 } | 19 } |
20 } | 20 } |
21 | 21 |
22 TopLevelDisplayClient::TopLevelDisplayClient( | 22 TopLevelDisplayClient::TopLevelDisplayClient( |
23 gfx::AcceleratedWidget widget, | 23 gfx::AcceleratedWidget widget, |
24 const scoped_refptr<gles2::GpuState>& gpu_state, | 24 const scoped_refptr<GpuState>& gpu_state, |
25 const scoped_refptr<SurfacesState>& surfaces_state) | 25 const scoped_refptr<SurfacesState>& surfaces_state) |
26 : surfaces_state_(surfaces_state), | 26 : surfaces_state_(surfaces_state), |
27 factory_(surfaces_state->manager(), this), | 27 factory_(surfaces_state->manager(), this), |
28 cc_id_(static_cast<uint64_t>(surfaces_state->next_id_namespace()) << 32) { | 28 cc_id_(static_cast<uint64_t>(surfaces_state->next_id_namespace()) << 32) { |
29 factory_.Create(cc_id_); | 29 factory_.Create(cc_id_); |
30 | 30 |
31 display_.reset(new cc::Display(this, surfaces_state_->manager(), nullptr, | 31 display_.reset(new cc::Display(this, surfaces_state_->manager(), nullptr, |
32 nullptr, cc::RendererSettings())); | 32 nullptr, cc::RendererSettings())); |
33 surfaces_state_->scheduler()->AddDisplay(display_.get()); | 33 surfaces_state_->scheduler()->AddDisplay(display_.get()); |
34 | 34 |
35 // TODO(brianderson): Reconcile with SurfacesScheduler crbug.com/476676 | 35 // TODO(brianderson): Reconcile with SurfacesScheduler crbug.com/476676 |
36 cc::DisplayScheduler* null_display_scheduler = nullptr; | 36 cc::DisplayScheduler* null_display_scheduler = nullptr; |
37 display_->Initialize( | 37 display_->Initialize( |
38 make_scoped_ptr(new surfaces::DirectOutputSurface( | 38 make_scoped_ptr(new DirectOutputSurface( |
39 new SurfacesContextProvider(this, widget, gpu_state))), | 39 new SurfacesContextProvider(this, widget, gpu_state))), |
40 null_display_scheduler); | 40 null_display_scheduler); |
41 | 41 |
42 display_->Resize(last_submitted_frame_size_); | 42 display_->Resize(last_submitted_frame_size_); |
43 | 43 |
44 // TODO(fsamuel): Plumb the proper device scale factor. | 44 // TODO(fsamuel): Plumb the proper device scale factor. |
45 display_->SetSurfaceId(cc_id_, 1.f /* device_scale_factor */); | 45 display_->SetSurfaceId(cc_id_, 1.f /* device_scale_factor */); |
46 } | 46 } |
47 | 47 |
48 TopLevelDisplayClient::~TopLevelDisplayClient() { | 48 TopLevelDisplayClient::~TopLevelDisplayClient() { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 surfaces_state_->scheduler()->OnVSyncParametersUpdated( | 94 surfaces_state_->scheduler()->OnVSyncParametersUpdated( |
95 base::TimeTicks::FromInternalValue(timebase), | 95 base::TimeTicks::FromInternalValue(timebase), |
96 base::TimeDelta::FromInternalValue(interval)); | 96 base::TimeDelta::FromInternalValue(interval)); |
97 } | 97 } |
98 | 98 |
99 void TopLevelDisplayClient::ReturnResources( | 99 void TopLevelDisplayClient::ReturnResources( |
100 const cc::ReturnedResourceArray& resources) { | 100 const cc::ReturnedResourceArray& resources) { |
101 // TODO(fsamuel): Implement this. | 101 // TODO(fsamuel): Implement this. |
102 } | 102 } |
103 | 103 |
104 } // namespace surfaces | 104 } // namespace mus |
OLD | NEW |