Chromium Code Reviews| 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 "android_webview/browser/hardware_renderer.h" | 5 #include "android_webview/browser/hardware_renderer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_gl_surface.h" | 9 #include "android_webview/browser/aw_gl_surface.h" |
| 10 #include "android_webview/browser/aw_render_thread_context_provider.h" | 10 #include "android_webview/browser/aw_render_thread_context_provider.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 void HardwareRenderer::AllocateSurface() { | 160 void HardwareRenderer::AllocateSurface() { |
| 161 DCHECK(!child_id_.is_valid()); | 161 DCHECK(!child_id_.is_valid()); |
| 162 child_id_ = local_surface_id_allocator_->GenerateId(); | 162 child_id_ = local_surface_id_allocator_->GenerateId(); |
| 163 surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_)); | 163 surfaces_->AddChildId(cc::SurfaceId(frame_sink_id_, child_id_)); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void HardwareRenderer::DestroySurface() { | 166 void HardwareRenderer::DestroySurface() { |
| 167 DCHECK(child_id_.is_valid()); | 167 DCHECK(child_id_.is_valid()); |
| 168 | 168 |
| 169 // Submit an empty frame to force any existing resources to be returned. | 169 // Submit an empty frame to force any existing resources to be returned. |
| 170 support_->SubmitCompositorFrame(child_id_, cc::CompositorFrame()); | 170 cc::CompositorFrame frame; |
| 171 // We submit without a prior BeginFrame, so acknowledge a manual BeginFrame. | |
| 172 frame.metadata.begin_frame_ack = | |
| 173 cc::BeginFrameAck(cc::BeginFrameArgs::kManualSourceId, | |
| 174 cc::BeginFrameArgs::kStartingFrameNumber, | |
| 175 cc::BeginFrameArgs::kStartingFrameNumber, 0, true); | |
|
piman
2017/03/17 18:12:01
nit: this is used in many places, maybe a static c
Eric Seckler
2017/03/20 11:54:03
Done.
| |
| 176 support_->SubmitCompositorFrame(child_id_, std::move(frame)); | |
| 171 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_)); | 177 surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_)); |
| 172 support_->EvictFrame(); | 178 support_->EvictFrame(); |
| 173 child_id_ = cc::LocalSurfaceId(); | 179 child_id_ = cc::LocalSurfaceId(); |
| 174 } | 180 } |
| 175 | 181 |
| 176 void HardwareRenderer::DidReceiveCompositorFrameAck() {} | 182 void HardwareRenderer::DidReceiveCompositorFrameAck() {} |
| 177 | 183 |
| 178 void HardwareRenderer::OnBeginFrame(const cc::BeginFrameArgs& args) { | 184 void HardwareRenderer::OnBeginFrame(const cc::BeginFrameArgs& args) { |
| 179 // TODO(tansell): Hook this up. | 185 // TODO(tansell): Hook this up. |
| 180 } | 186 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 | 259 |
| 254 void HardwareRenderer::CreateNewCompositorFrameSinkSupport() { | 260 void HardwareRenderer::CreateNewCompositorFrameSinkSupport() { |
| 255 support_.reset(); | 261 support_.reset(); |
| 256 support_ = base::MakeUnique<cc::CompositorFrameSinkSupport>( | 262 support_ = base::MakeUnique<cc::CompositorFrameSinkSupport>( |
| 257 this, surfaces_->GetSurfaceManager(), frame_sink_id_, false /* is_root */, | 263 this, surfaces_->GetSurfaceManager(), frame_sink_id_, false /* is_root */, |
| 258 false /* handles_frame_sink_id_invalidation */, | 264 false /* handles_frame_sink_id_invalidation */, |
| 259 true /* needs_sync_points */); | 265 true /* needs_sync_points */); |
| 260 } | 266 } |
| 261 | 267 |
| 262 } // namespace android_webview | 268 } // namespace android_webview |
| OLD | NEW |