Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: components/surfaces/display_impl.cc

Issue 1138563002: Add DisplayScheduler for Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rendererLatencyRecoveryHeuristic
Patch Set: rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/surfaces/display_impl.h ('k') | components/surfaces/surfaces_scheduler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 base::Bind(&DisplayImpl::OnContextCreated, base::Unretained(this))); 44 base::Bind(&DisplayImpl::OnContextCreated, base::Unretained(this)));
45 factory_.Create(cc_id_); 45 factory_.Create(cc_id_);
46 } 46 }
47 47
48 void DisplayImpl::OnContextCreated(mojo::CommandBufferPtr gles2_client) { 48 void DisplayImpl::OnContextCreated(mojo::CommandBufferPtr gles2_client) {
49 DCHECK(!display_); 49 DCHECK(!display_);
50 50
51 cc::RendererSettings settings; 51 cc::RendererSettings settings;
52 display_.reset(new cc::Display(this, manager_, nullptr, nullptr, settings)); 52 display_.reset(new cc::Display(this, manager_, nullptr, nullptr, settings));
53 scheduler_->AddDisplay(display_.get()); 53 scheduler_->AddDisplay(display_.get());
54 display_->Initialize(make_scoped_ptr( 54
55 new surfaces::DirectOutputSurface(new surfaces::SurfacesContextProvider( 55 // TODO(brianderson): Reconcile with SurfacesScheduler crbug.com/476676
56 gles2_client.PassInterface().PassHandle())))); 56 cc::DisplayScheduler* null_display_scheduler = nullptr;
57 display_->Initialize(make_scoped_ptr(new surfaces::DirectOutputSurface(
58 new surfaces::SurfacesContextProvider(
59 gles2_client.PassInterface().PassHandle()))),
60 null_display_scheduler);
57 display_->Resize(last_submitted_frame_size_); 61 display_->Resize(last_submitted_frame_size_);
58 62
59 display_->SetSurfaceId(cc_id_, 1.f); 63 display_->SetSurfaceId(cc_id_, 1.f);
60 if (pending_frame_) 64 if (pending_frame_)
61 Draw(); 65 Draw();
62 } 66 }
63 67
64 DisplayImpl::~DisplayImpl() { 68 DisplayImpl::~DisplayImpl() {
65 if (display_) { 69 if (display_) {
66 factory_.Destroy(cc_id_); 70 factory_.Destroy(cc_id_);
(...skipping 20 matching lines...) Expand all
87 last_submitted_frame_size_ = frame_size; 91 last_submitted_frame_size_ = frame_size;
88 display_->Resize(frame_size); 92 display_->Resize(frame_size);
89 factory_.SubmitFrame(cc_id_, 93 factory_.SubmitFrame(cc_id_,
90 pending_frame_.To<scoped_ptr<cc::CompositorFrame>>(), 94 pending_frame_.To<scoped_ptr<cc::CompositorFrame>>(),
91 base::Bind(&CallCallback, pending_callback_)); 95 base::Bind(&CallCallback, pending_callback_));
92 pending_frame_.reset(); 96 pending_frame_.reset();
93 scheduler_->SetNeedsDraw(); 97 scheduler_->SetNeedsDraw();
94 pending_callback_.reset(); 98 pending_callback_.reset();
95 } 99 }
96 100
97 void DisplayImpl::DisplayDamaged() {
98 }
99
100 void DisplayImpl::DidSwapBuffers() {
101 }
102
103 void DisplayImpl::DidSwapBuffersComplete() {
104 }
105
106 void DisplayImpl::CommitVSyncParameters(base::TimeTicks timebase, 101 void DisplayImpl::CommitVSyncParameters(base::TimeTicks timebase,
107 base::TimeDelta interval) { 102 base::TimeDelta interval) {
108 } 103 }
109 104
110 void DisplayImpl::OutputSurfaceLost() { 105 void DisplayImpl::OutputSurfaceLost() {
111 if (!display_) // Shutdown case 106 if (!display_) // Shutdown case
112 return; 107 return;
113 108
114 // If our OutputSurface is lost we can't draw until we get a new one. For now, 109 // If our OutputSurface is lost we can't draw until we get a new one. For now,
115 // destroy the display and create a new one when our ContextProvider provides 110 // destroy the display and create a new one when our ContextProvider provides
(...skipping 26 matching lines...) Expand all
142 DCHECK(returner_); 137 DCHECK(returner_);
143 138
144 mojo::Array<mojo::ReturnedResourcePtr> ret(resources.size()); 139 mojo::Array<mojo::ReturnedResourcePtr> ret(resources.size());
145 for (size_t i = 0; i < resources.size(); ++i) { 140 for (size_t i = 0; i < resources.size(); ++i) {
146 ret[i] = mojo::ReturnedResource::From(resources[i]); 141 ret[i] = mojo::ReturnedResource::From(resources[i]);
147 } 142 }
148 returner_->ReturnResources(ret.Pass()); 143 returner_->ReturnResources(ret.Pass());
149 } 144 }
150 145
151 } // namespace surfaces 146 } // namespace surfaces
OLDNEW
« no previous file with comments | « components/surfaces/display_impl.h ('k') | components/surfaces/surfaces_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698