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

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

Issue 10828356: Very basic Android browser-side compositing support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments, rebase Created 8 years, 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/renderer_host/compositor_impl_android.h"
6
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "base/memory/singleton.h"
10 #include "content/browser/android/graphics_context.h"
11 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
12 #include "content/common/gpu/client/gpu_channel_host.h"
13 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
14 #include "content/common/gpu/gpu_process_launch_causes.h"
15 #include "content/public/browser/render_widget_host_view.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositor.h"
17
18 namespace content {
19
20 // static
21 Compositor* Compositor::GetInstance() {
22 return CompositorImpl::GetInstance();
23 }
24
25 // static
26 CompositorImpl* CompositorImpl::GetInstance() {
27 return Singleton<CompositorImpl>::get();
28 }
29
30 CompositorImpl::CompositorImpl()
31 : root_layer_(WebKit::WebLayer::create()) {
32 }
33
34 CompositorImpl::~CompositorImpl() {
35 }
36
37 void CompositorImpl::SurfaceUpdated(const SurfacePresentedCallback& callback) {
38 host_.composite();
39 uint32 sync_point = context_->InsertSyncPoint();
40 callback.Run(sync_point);
41 }
42
43 void CompositorImpl::SetRootLayer(const WebKit::WebLayer& root_layer) {
44 root_layer_.removeAllChildren();
45 root_layer_.addChild(root_layer);
46 }
47
48 void CompositorImpl::SetWindowSurface(ANativeWindow* window) {
49 if (window) {
50 context_.reset(GraphicsContext::CreateForUI(window));
51 WebKit::WebCompositor::initialize(NULL);
52 WebKit::WebLayerTreeView::Settings settings;
53 settings.refreshRate = 60.0;
54 host_.initialize(this, root_layer_, settings);
55 host_.setVisible(true);
56 host_.setSurfaceReady();
57 } else {
58 context_.reset(NULL);
59 }
60 }
61
62 void CompositorImpl::SetWindowBounds(const gfx::Size& size) {
63 if (size_ == size)
64 return;
65
66 size_ = size;
67 host_.setViewportSize(size);
68 root_layer_.setBounds(size);
69 }
70
71 void CompositorImpl::updateAnimations(double frameBeginTime) {
72 }
73
74 void CompositorImpl::layout() {
75 }
76
77 void CompositorImpl::applyScrollAndScale(const WebKit::WebSize& scrollDelta,
78 float scaleFactor) {
79 }
80
81 WebKit::WebGraphicsContext3D* CompositorImpl::createContext3D() {
82 WebKit::WebGraphicsContext3D::Attributes attrs;
83 attrs.shareResources = true;
84 GpuChannelHostFactory* factory = BrowserGpuChannelHostFactory::instance();
85 GURL url("chrome://gpu/Compositor::createContext3D");
86 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client;
87 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
88 new WebGraphicsContext3DCommandBufferImpl(
89 context_->GetSurfaceID(),
90 url,
91 factory,
92 swap_client));
93 if (!context->Initialize(
94 attrs,
95 false,
96 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)) {
97 return NULL;
98 }
99
100 return context.release();
101 }
102
103 void CompositorImpl::didRebindGraphicsContext(bool success) {
104 }
105
106 void CompositorImpl::didCommit() {
107 }
108
109 void CompositorImpl::didCommitAndDrawFrame() {
110 }
111
112 void CompositorImpl::didCompleteSwapBuffers() {
113 }
114
115 void CompositorImpl::scheduleComposite() {
116 }
117
118 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698