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

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

Issue 1827123002: Move content/common/gpu/client to gpu/ipc/client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 8 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 <utility> 10 #include <utility>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "cc/trees/layer_tree_host.h" 42 #include "cc/trees/layer_tree_host.h"
43 #include "cc/trees/layer_tree_settings.h" 43 #include "cc/trees/layer_tree_settings.h"
44 #include "content/browser/android/child_process_launcher_android.h" 44 #include "content/browser/android/child_process_launcher_android.h"
45 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor_android.h" 45 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor_android.h"
46 #include "content/browser/compositor/gl_helper.h" 46 #include "content/browser/compositor/gl_helper.h"
47 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 47 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
48 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 48 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
49 #include "content/browser/gpu/compositor_util.h" 49 #include "content/browser/gpu/compositor_util.h"
50 #include "content/browser/gpu/gpu_surface_tracker.h" 50 #include "content/browser/gpu/gpu_surface_tracker.h"
51 #include "content/browser/renderer_host/render_widget_host_impl.h" 51 #include "content/browser/renderer_host/render_widget_host_impl.h"
52 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
53 #include "content/common/gpu/client/context_provider_command_buffer.h" 52 #include "content/common/gpu/client/context_provider_command_buffer.h"
54 #include "content/common/gpu/client/gpu_channel_host.h"
55 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 53 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
56 #include "content/common/gpu_process_launch_causes.h" 54 #include "content/common/gpu_process_launch_causes.h"
57 #include "content/common/host_shared_bitmap_manager.h" 55 #include "content/common/host_shared_bitmap_manager.h"
58 #include "content/public/browser/android/compositor.h" 56 #include "content/public/browser/android/compositor.h"
59 #include "content/public/browser/android/compositor_client.h" 57 #include "content/public/browser/android/compositor_client.h"
60 #include "content/public/common/content_switches.h" 58 #include "content/public/common/content_switches.h"
61 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" 59 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h"
62 #include "gpu/command_buffer/client/context_support.h" 60 #include "gpu/command_buffer/client/context_support.h"
63 #include "gpu/command_buffer/client/gles2_interface.h" 61 #include "gpu/command_buffer/client/gles2_interface.h"
62 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
63 #include "gpu/ipc/client/gpu_channel_host.h"
64 #include "third_party/khronos/GLES2/gl2.h" 64 #include "third_party/khronos/GLES2/gl2.h"
65 #include "third_party/khronos/GLES2/gl2ext.h" 65 #include "third_party/khronos/GLES2/gl2ext.h"
66 #include "third_party/skia/include/core/SkMallocPixelRef.h" 66 #include "third_party/skia/include/core/SkMallocPixelRef.h"
67 #include "ui/android/window_android.h" 67 #include "ui/android/window_android.h"
68 #include "ui/gfx/android/device_display_info.h" 68 #include "ui/gfx/android/device_display_info.h"
69 #include "ui/gfx/swap_result.h" 69 #include "ui/gfx/swap_result.h"
70 70
71 namespace content { 71 namespace content {
72 72
73 namespace { 73 namespace {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 compositor_->AddObserver(this); 121 compositor_->AddObserver(this);
122 122
123 return true; 123 return true;
124 } 124 }
125 125
126 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override { 126 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override {
127 return overlay_candidate_validator_.get(); 127 return overlay_candidate_validator_.get();
128 } 128 }
129 129
130 private: 130 private:
131 CommandBufferProxyImpl* GetCommandBufferProxy() { 131 gpu::CommandBufferProxyImpl* GetCommandBufferProxy() {
132 ContextProviderCommandBuffer* provider_command_buffer = 132 ContextProviderCommandBuffer* provider_command_buffer =
133 static_cast<content::ContextProviderCommandBuffer*>( 133 static_cast<content::ContextProviderCommandBuffer*>(
134 context_provider_.get()); 134 context_provider_.get());
135 CommandBufferProxyImpl* command_buffer_proxy = 135 gpu::CommandBufferProxyImpl* command_buffer_proxy =
136 provider_command_buffer->GetCommandBufferProxy(); 136 provider_command_buffer->GetCommandBufferProxy();
137 DCHECK(command_buffer_proxy); 137 DCHECK(command_buffer_proxy);
138 return command_buffer_proxy; 138 return command_buffer_proxy;
139 } 139 }
140 140
141 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, 141 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info,
142 gfx::SwapResult result) { 142 gfx::SwapResult result) {
143 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); 143 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
144 OutputSurface::OnSwapBuffersComplete(); 144 OutputSurface::OnSwapBuffersComplete();
145 } 145 }
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 404 }
405 405
406 void CompositorImpl::SetNeedsComposite() { 406 void CompositorImpl::SetNeedsComposite() {
407 if (!host_->visible()) 407 if (!host_->visible())
408 return; 408 return;
409 host_->SetNeedsAnimate(); 409 host_->SetNeedsAnimate();
410 } 410 }
411 411
412 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl> 412 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
413 CreateGpuProcessViewContext( 413 CreateGpuProcessViewContext(
414 const scoped_refptr<GpuChannelHost>& gpu_channel_host, 414 const scoped_refptr<gpu::GpuChannelHost>& gpu_channel_host,
415 const gpu::gles2::ContextCreationAttribHelper& attributes, 415 const gpu::gles2::ContextCreationAttribHelper& attributes,
416 int surface_id) { 416 int surface_id) {
417 GURL url("chrome://gpu/Compositor::createContext3D"); 417 GURL url("chrome://gpu/Compositor::createContext3D");
418 static const size_t kBytesPerPixel = 4; 418 static const size_t kBytesPerPixel = 4;
419 gfx::DeviceDisplayInfo display_info; 419 gfx::DeviceDisplayInfo display_info;
420 size_t full_screen_texture_size_in_bytes = 420 size_t full_screen_texture_size_in_bytes =
421 display_info.GetDisplayHeight() * 421 display_info.GetDisplayHeight() *
422 display_info.GetDisplayWidth() * 422 display_info.GetDisplayWidth() *
423 kBytesPerPixel; 423 kBytesPerPixel;
424 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; 424 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 532
533 DCHECK(window_); 533 DCHECK(window_);
534 DCHECK(surface_id_); 534 DCHECK(surface_id_);
535 535
536 BrowserGpuChannelHostFactory* factory = 536 BrowserGpuChannelHostFactory* factory =
537 BrowserGpuChannelHostFactory::instance(); 537 BrowserGpuChannelHostFactory::instance();
538 // This channel might be lost (and even if it isn't right now, it might 538 // This channel might be lost (and even if it isn't right now, it might
539 // still get marked as lost from the IO thread, at any point in time really). 539 // still get marked as lost from the IO thread, at any point in time really).
540 // But from here on just try and always lead to either 540 // But from here on just try and always lead to either
541 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). 541 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface().
542 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); 542 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(factory->GetGpuChannel());
543 scoped_refptr<ContextProviderCommandBuffer> context_provider( 543 scoped_refptr<ContextProviderCommandBuffer> context_provider(
544 ContextProviderCommandBuffer::Create( 544 ContextProviderCommandBuffer::Create(
545 CreateGpuProcessViewContext(gpu_channel_host, attributes, 545 CreateGpuProcessViewContext(gpu_channel_host, attributes,
546 surface_id_), 546 surface_id_),
547 DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT)); 547 DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT));
548 DCHECK(context_provider.get()); 548 DCHECK(context_provider.get());
549 549
550 scoped_ptr<cc::OutputSurface> real_output_surface( 550 scoped_ptr<cc::OutputSurface> real_output_surface(
551 new OutputSurfaceWithoutParent( 551 new OutputSurfaceWithoutParent(
552 this, context_provider, 552 this, context_provider,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 646
647 void CompositorImpl::SetNeedsAnimate() { 647 void CompositorImpl::SetNeedsAnimate() {
648 needs_animate_ = true; 648 needs_animate_ = true;
649 if (!host_->visible()) 649 if (!host_->visible())
650 return; 650 return;
651 651
652 host_->SetNeedsAnimate(); 652 host_->SetNeedsAnimate();
653 } 653 }
654 654
655 } // namespace content 655 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_ipc_browsertests.cc ('k') | content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698