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

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

Issue 10917181: Use WebCompositorSupport instead of static functions in compositor_impl_android.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/browser/android/graphics_context.h" 9 #include "content/browser/android/graphics_context.h"
10 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 10 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
11 #include "content/common/gpu/client/gpu_channel_host.h" 11 #include "content/common/gpu/client/gpu_channel_host.h"
12 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 12 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
13 #include "content/common/gpu/gpu_process_launch_causes.h" 13 #include "content/common/gpu/gpu_process_launch_causes.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositor.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSuppor t.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Surface.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Surface.h"
16 17
17 namespace { 18 namespace {
18 19
19 // Adapts a pure WebGraphicsContext3D into a WebCompositorOutputSurface. 20 // Adapts a pure WebGraphicsContext3D into a WebCompositorOutputSurface.
20 class WebGraphicsContextToOutputSurfaceAdapter : 21 class WebGraphicsContextToOutputSurfaceAdapter :
21 public WebKit::WebCompositorOutputSurface { 22 public WebKit::WebCompositorOutputSurface {
22 public: 23 public:
23 explicit WebGraphicsContextToOutputSurfaceAdapter( 24 explicit WebGraphicsContextToOutputSurfaceAdapter(
24 WebKit::WebGraphicsContext3D* context) 25 WebKit::WebGraphicsContext3D* context)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 63
63 namespace content { 64 namespace content {
64 65
65 // static 66 // static
66 Compositor* Compositor::Create() { 67 Compositor* Compositor::Create() {
67 return new CompositorImpl(); 68 return new CompositorImpl();
68 } 69 }
69 70
70 // static 71 // static
71 void Compositor::Initialize() { 72 void Compositor::Initialize() {
72 WebKit::WebCompositor::initialize(NULL); 73 WebKit::Platform::current()->compositorSupport()->initialize(NULL);
73 } 74 }
74 75
75 CompositorImpl::CompositorImpl() 76 CompositorImpl::CompositorImpl() {
76 : root_layer_(WebKit::WebLayer::create()) { 77 root_layer_.reset(
78 WebKit::Platform::current()->compositorSupport()->createLayer());
77 } 79 }
78 80
79 CompositorImpl::~CompositorImpl() { 81 CompositorImpl::~CompositorImpl() {
80 } 82 }
81 83
82 void CompositorImpl::OnSurfaceUpdated( 84 void CompositorImpl::OnSurfaceUpdated(
83 const SurfacePresentedCallback& callback) { 85 const SurfacePresentedCallback& callback) {
84 host_->composite(); 86 host_->composite();
85 uint32 sync_point = context_->InsertSyncPoint(); 87 uint32 sync_point = context_->InsertSyncPoint();
86 callback.Run(sync_point); 88 callback.Run(sync_point);
87 } 89 }
88 90
89 void CompositorImpl::SetRootLayer(WebKit::WebLayer* root_layer) { 91 void CompositorImpl::SetRootLayer(WebKit::WebLayer* root_layer) {
90 root_layer_->removeAllChildren(); 92 root_layer_->removeAllChildren();
91 root_layer_->addChild(root_layer); 93 root_layer_->addChild(root_layer);
92 } 94 }
93 95
94 void CompositorImpl::SetWindowSurface(ANativeWindow* window) { 96 void CompositorImpl::SetWindowSurface(ANativeWindow* window) {
95 if (window) { 97 if (window) {
96 context_.reset(GraphicsContext::CreateForUI(window)); 98 context_.reset(GraphicsContext::CreateForUI(window));
97 WebKit::WebLayerTreeView::Settings settings; 99 WebKit::WebLayerTreeView::Settings settings;
98 settings.refreshRate = 60.0; 100 settings.refreshRate = 60.0;
99 host_.reset(WebKit::WebLayerTreeView::create(this, *root_layer_, settings)); 101 WebKit::WebCompositorSupport* compositor_support =
102 WebKit::Platform::current()->compositorSupport();
103 host_.reset(
104 compositor_support->createLayerTreeView(this, *root_layer_, settings));
100 host_->setVisible(true); 105 host_->setVisible(true);
101 host_->setSurfaceReady(); 106 host_->setSurfaceReady();
102 } else { 107 } else {
103 context_.reset(NULL); 108 context_.reset(NULL);
104 size_ = gfx::Size(); 109 size_ = gfx::Size();
105 } 110 }
106 } 111 }
107 112
108 void CompositorImpl::SetWindowBounds(const gfx::Size& size) { 113 void CompositorImpl::SetWindowBounds(const gfx::Size& size) {
109 if (size_ == size) 114 if (size_ == size)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 void CompositorImpl::didCommitAndDrawFrame() { 164 void CompositorImpl::didCommitAndDrawFrame() {
160 } 165 }
161 166
162 void CompositorImpl::didCompleteSwapBuffers() { 167 void CompositorImpl::didCompleteSwapBuffers() {
163 } 168 }
164 169
165 void CompositorImpl::scheduleComposite() { 170 void CompositorImpl::scheduleComposite() {
166 } 171 }
167 172
168 } // namespace content 173 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698