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

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 2403373002: cc: Clean up OutputSurfaceClient. (Closed)
Patch Set: osclient: rebase Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/compositor_impl_android.h" 5 #include "content/browser/renderer_host/compositor_impl_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <unordered_set> 10 #include <unordered_set>
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 provider_command_buffer->GetCommandBufferProxy(); 295 provider_command_buffer->GetCommandBufferProxy();
296 DCHECK(command_buffer_proxy); 296 DCHECK(command_buffer_proxy);
297 return command_buffer_proxy; 297 return command_buffer_proxy;
298 } 298 }
299 299
300 void OnSwapBuffersCompleted( 300 void OnSwapBuffersCompleted(
301 const std::vector<ui::LatencyInfo>& latency_info, 301 const std::vector<ui::LatencyInfo>& latency_info,
302 gfx::SwapResult result, 302 gfx::SwapResult result,
303 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { 303 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) {
304 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); 304 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
305 client_->DidSwapBuffersComplete(); 305 client_->DidReceiveSwapBuffersAck();
306 } 306 }
307 307
308 private: 308 private:
309 base::Callback<void(gpu::Capabilities)> populate_gpu_capabilities_callback_; 309 base::Callback<void(gpu::Capabilities)> populate_gpu_capabilities_callback_;
310 base::CancelableCallback<void( 310 base::CancelableCallback<void(
311 const std::vector<ui::LatencyInfo>&, 311 const std::vector<ui::LatencyInfo>&,
312 gfx::SwapResult, 312 gfx::SwapResult,
313 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac)> 313 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac)>
314 swap_buffers_completion_callback_; 314 swap_buffers_completion_callback_;
315 std::unique_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator_; 315 std::unique_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator_;
(...skipping 26 matching lines...) Expand all
342 342
343 bool BindToClient(cc::OutputSurfaceClient* client) override { 343 bool BindToClient(cc::OutputSurfaceClient* client) override {
344 if (!OutputSurface::BindToClient(client)) 344 if (!OutputSurface::BindToClient(client))
345 return false; 345 return false;
346 return true; 346 return true;
347 } 347 }
348 348
349 void SwapBuffers(cc::CompositorFrame frame) override { 349 void SwapBuffers(cc::CompositorFrame frame) override {
350 surface_->SwapBuffers(); 350 surface_->SwapBuffers();
351 task_runner_->PostTask(FROM_HERE, 351 task_runner_->PostTask(FROM_HERE,
352 base::Bind(&VulkanOutputSurface::SwapBuffersCallback, 352 base::Bind(&VulkanOutputSurface::SwapBuffersAck,
353 weak_ptr_factory_.GetWeakPtr())); 353 weak_ptr_factory_.GetWeakPtr()));
354 } 354 }
355 355
356 void Destroy() { 356 void Destroy() {
357 if (surface_) { 357 if (surface_) {
358 surface_->Destroy(); 358 surface_->Destroy();
359 surface_.reset(); 359 surface_.reset();
360 } 360 }
361 } 361 }
362 362
363 private: 363 private:
364 void OutputSurface::SwapBuffersCallback() { 364 void SwapBuffersAck() { client_->DidReceiveSwapBuffersAck(); }
365 client_->DidSwapBuffersComplete();
366 }
367 365
368 std::unique_ptr<gpu::VulkanSurface> surface_; 366 std::unique_ptr<gpu::VulkanSurface> surface_;
369 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 367 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
370 base::WeakPtrFactory<VulkanOutputSurface> weak_ptr_factory_; 368 base::WeakPtrFactory<VulkanOutputSurface> weak_ptr_factory_;
371 369
372 DISALLOW_COPY_AND_ASSIGN(VulkanOutputSurface); 370 DISALLOW_COPY_AND_ASSIGN(VulkanOutputSurface);
373 }; 371 };
374 #endif 372 #endif
375 373
376 static bool g_initialized = false; 374 static bool g_initialized = false;
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 837
840 cc::FrameSinkId CompositorImpl::GetFrameSinkId() { 838 cc::FrameSinkId CompositorImpl::GetFrameSinkId() {
841 return frame_sink_id_; 839 return frame_sink_id_;
842 } 840 }
843 841
844 bool CompositorImpl::HavePendingReadbacks() { 842 bool CompositorImpl::HavePendingReadbacks() {
845 return !readback_layer_tree_->children().empty(); 843 return !readback_layer_tree_->children().empty();
846 } 844 }
847 845
848 } // namespace content 846 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/vulkan_browser_compositor_output_surface.cc ('k') | services/ui/surfaces/direct_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698