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

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

Issue 628703005: Remove GpuHostMsg_FrameDrawn and replace with client channel swap ack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 11 matching lines...) Expand all
22 #include "cc/base/switches.h" 22 #include "cc/base/switches.h"
23 #include "cc/input/input_handler.h" 23 #include "cc/input/input_handler.h"
24 #include "cc/layers/layer.h" 24 #include "cc/layers/layer.h"
25 #include "cc/output/compositor_frame.h" 25 #include "cc/output/compositor_frame.h"
26 #include "cc/output/context_provider.h" 26 #include "cc/output/context_provider.h"
27 #include "cc/output/output_surface.h" 27 #include "cc/output/output_surface.h"
28 #include "cc/trees/layer_tree_host.h" 28 #include "cc/trees/layer_tree_host.h"
29 #include "content/browser/android/child_process_launcher_android.h" 29 #include "content/browser/android/child_process_launcher_android.h"
30 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 30 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
31 #include "content/browser/gpu/gpu_surface_tracker.h" 31 #include "content/browser/gpu/gpu_surface_tracker.h"
32 #include "content/browser/renderer_host/render_widget_host_impl.h"
32 #include "content/common/gpu/client/command_buffer_proxy_impl.h" 33 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
33 #include "content/common/gpu/client/context_provider_command_buffer.h" 34 #include "content/common/gpu/client/context_provider_command_buffer.h"
34 #include "content/common/gpu/client/gl_helper.h" 35 #include "content/common/gpu/client/gl_helper.h"
35 #include "content/common/gpu/client/gpu_channel_host.h" 36 #include "content/common/gpu/client/gpu_channel_host.h"
36 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 37 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
37 #include "content/common/gpu/gpu_process_launch_causes.h" 38 #include "content/common/gpu/gpu_process_launch_causes.h"
38 #include "content/common/host_shared_bitmap_manager.h" 39 #include "content/common/host_shared_bitmap_manager.h"
39 #include "content/public/browser/android/compositor_client.h" 40 #include "content/public/browser/android/compositor_client.h"
41 #include "gpu/command_buffer/client/context_support.h"
40 #include "gpu/command_buffer/client/gles2_interface.h" 42 #include "gpu/command_buffer/client/gles2_interface.h"
41 #include "third_party/khronos/GLES2/gl2.h" 43 #include "third_party/khronos/GLES2/gl2.h"
42 #include "third_party/khronos/GLES2/gl2ext.h" 44 #include "third_party/khronos/GLES2/gl2ext.h"
43 #include "third_party/skia/include/core/SkMallocPixelRef.h" 45 #include "third_party/skia/include/core/SkMallocPixelRef.h"
44 #include "ui/base/android/window_android.h" 46 #include "ui/base/android/window_android.h"
45 #include "ui/gfx/android/device_display_info.h" 47 #include "ui/gfx/android/device_display_info.h"
46 #include "ui/gfx/frame_time.h" 48 #include "ui/gfx/frame_time.h"
47 #include "ui/gl/android/surface_texture.h" 49 #include "ui/gl/android/surface_texture.h"
48 #include "ui/gl/android/surface_texture_tracker.h" 50 #include "ui/gl/android/surface_texture_tracker.h"
49 #include "webkit/common/gpu/context_provider_in_process.h" 51 #include "webkit/common/gpu/context_provider_in_process.h"
(...skipping 20 matching lines...) Expand all
70 frame->metadata.latency_info[i].AddLatencyNumber( 72 frame->metadata.latency_info[i].AddLatencyNumber(
71 ui::INPUT_EVENT_BROWSER_SWAP_BUFFER_COMPONENT, 0, 0); 73 ui::INPUT_EVENT_BROWSER_SWAP_BUFFER_COMPONENT, 0, 0);
72 } 74 }
73 75
74 content::ContextProviderCommandBuffer* provider_command_buffer = 76 content::ContextProviderCommandBuffer* provider_command_buffer =
75 static_cast<content::ContextProviderCommandBuffer*>( 77 static_cast<content::ContextProviderCommandBuffer*>(
76 context_provider_.get()); 78 context_provider_.get());
77 content::CommandBufferProxyImpl* command_buffer_proxy = 79 content::CommandBufferProxyImpl* command_buffer_proxy =
78 provider_command_buffer->GetCommandBufferProxy(); 80 provider_command_buffer->GetCommandBufferProxy();
79 DCHECK(command_buffer_proxy); 81 DCHECK(command_buffer_proxy);
80 command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); 82 command_buffer_proxy->SetLatencyInfo(
81 83 frame->metadata.latency_info,
82 OutputSurface::SwapBuffers(frame); 84 base::Bind(&OutputSurfaceWithoutParent::OnSwapBuffersCompleted,
85 base::Unretained(this)));
piman 2014/10/07 02:30:39 Same concern here wrt lifetime.
86 context_provider_->ContextSupport()->Swap();
piman 2014/10/07 02:30:39 nit: add a DCHECK that the frame is a full frame?
no sievers 2014/10/07 19:47:24 Done.
83 } 87 }
84 88
85 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE { 89 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE {
86 if (!OutputSurface::BindToClient(client)) 90 if (!OutputSurface::BindToClient(client))
87 return false; 91 return false;
88 92
89 main_thread_->PostTask( 93 main_thread_->PostTask(
90 FROM_HERE, 94 FROM_HERE,
91 base::Bind(&content::CompositorImpl::PopulateGpuCapabilities, 95 base::Bind(&content::CompositorImpl::PopulateGpuCapabilities,
92 compositor_impl_, 96 compositor_impl_,
93 context_provider_->ContextCapabilities().gpu)); 97 context_provider_->ContextCapabilities().gpu));
94 98
95 return true; 99 return true;
96 } 100 }
97 101
102 private:
103 void OnSwapBuffersCompleted(
104 const std::vector<ui::LatencyInfo>& latency_info) {
105 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
106 OutputSurface::OnSwapBuffersComplete();
107 }
108
98 scoped_refptr<base::MessageLoopProxy> main_thread_; 109 scoped_refptr<base::MessageLoopProxy> main_thread_;
99 base::WeakPtr<content::CompositorImpl> compositor_impl_; 110 base::WeakPtr<content::CompositorImpl> compositor_impl_;
100 }; 111 };
101 112
102 class SurfaceTextureTrackerImpl : public gfx::SurfaceTextureTracker { 113 class SurfaceTextureTrackerImpl : public gfx::SurfaceTextureTracker {
103 public: 114 public:
104 SurfaceTextureTrackerImpl() : next_surface_texture_id_(1) { 115 SurfaceTextureTrackerImpl() : next_surface_texture_id_(1) {
105 thread_checker_.DetachFromThread(); 116 thread_checker_.DetachFromThread();
106 } 117 }
107 118
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 } 698 }
688 699
689 void CompositorImpl::SetNeedsAnimate() { 700 void CompositorImpl::SetNeedsAnimate() {
690 if (!host_) 701 if (!host_)
691 return; 702 return;
692 703
693 host_->SetNeedsAnimate(); 704 host_->SetNeedsAnimate();
694 } 705 }
695 706
696 } // namespace content 707 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698