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

Side by Side Diff: ui/gfx/compositor/compositor_cc.cc

Issue 8222028: Use WebKit compositor in ui::Layer (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase,fixes Created 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 "ui/gfx/compositor/compositor_cc.h"
6
7 #include "base/bind.h"
jonathan.backer 2011/10/18 15:28:26 necessary?
piman 2011/10/19 17:53:23 Gone
8 #include "base/memory/ref_counted.h"
9 #include "base/message_loop_proxy.h"
jonathan.backer 2011/10/18 15:28:26 necessary?
piman 2011/10/19 17:53:23 Gone.
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatPoint.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h"
13 #include "ui/gfx/compositor/layer.h"
jonathan.backer 2011/10/18 15:28:26 necessary?
piman 2011/10/19 17:53:23 Just necessary for root_layer()->web_layer().
14 #include "webkit/glue/webthread_impl.h"
15 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
16
17 namespace {
18 webkit_glue::WebThreadImpl* g_compositor_thread = NULL;
19 } // anonymous namespace
20
21 namespace ui {
22
23 TextureCC::TextureCC() {
24 }
25
26 void TextureCC::SetCanvas(const SkCanvas& canvas,
27 const gfx::Point& origin,
28 const gfx::Size& overall_size) {
29 }
30
31 void TextureCC::Draw(const ui::TextureDrawParams& params,
32 const gfx::Rect& clip_bounds_in_texture) {
33 }
34
35 CompositorCC::CompositorCC(CompositorDelegate* delegate,
36 gfx::AcceleratedWidget widget,
37 const gfx::Size& size)
38 : Compositor(delegate, size),
39 widget_(widget),
40 root_web_layer_(WebKit::WebLayer::create(this)) {
41 WebKit::WebLayerTreeView::Settings settings;
42 settings.enableCompositorThread = !!g_compositor_thread;
43 host_ = WebKit::WebLayerTreeView::create(this, root_web_layer_, settings);
44 root_web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f));
45 OnWidgetSizeChanged();
46 }
47
48 CompositorCC::~CompositorCC() {
49 }
50
51 void CompositorCC::InitializeThread() {
52 g_compositor_thread = new webkit_glue::WebThreadImpl("Browser Compositor");
53 WebKit::WebCompositor::setThread(g_compositor_thread);
54 }
55
56 void CompositorCC::TerminateThread() {
57 DCHECK(g_compositor_thread);
58 delete g_compositor_thread;
59 g_compositor_thread = NULL;
60 }
61
62 Texture* CompositorCC::CreateTexture() {
63 return new TextureCC();
64 }
65
66 void CompositorCC::OnNotifyStart(bool clear) {
67 }
68
69 void CompositorCC::OnNotifyEnd() {
70 }
71
72 void CompositorCC::OnWidgetSizeChanged() {
73 host_.setViewportSize(size());
74 root_web_layer_.setBounds(size());
75 }
76
77 void CompositorCC::OnRootLayerChanged() {
78 DCHECK(!root_layer()->web_layer().isNull());
79 root_web_layer_.removeAllChildren();
80 root_web_layer_.addChild(root_layer()->web_layer());
81 }
82
83 void CompositorCC::DrawTree() {
84 host_.composite();
85 }
86
87 void CompositorCC::Blur(const gfx::Rect& bounds) {
88 }
89
90 void CompositorCC::animateAndLayout(double frameBeginTime) {
91 }
92
93 void CompositorCC::applyScrollDelta(const WebKit::WebSize&) {
94 }
95
96 WebKit::WebGraphicsContext3D* CompositorCC::createContext3D() {
97 WebKit::WebGraphicsContext3D* context =
98 new webkit::gpu::WebGraphicsContext3DInProcessImpl(widget_);
99 WebKit::WebGraphicsContext3D::Attributes attrs;
100 context->initialize(attrs, 0, true);
101 return context;
102 }
103
104 void CompositorCC::didRebindGraphicsContext(bool success) {
105 }
106
107 void CompositorCC::scheduleComposite() {
108 ScheduleDraw();
109 }
110
111 void CompositorCC::notifyNeedsComposite() {
112 ScheduleDraw();
113 }
114
115 void CompositorCC::ScheduleDraw() {
Ben Goodger (Google) 2011/10/16 22:39:51 order of functions in the .cc file should match .h
piman 2011/10/19 17:53:23 Done.
116 if (g_compositor_thread)
117 host_.composite();
118 else
119 Compositor::ScheduleDraw();
120 }
121
122 Compositor* Compositor::Create(CompositorDelegate* owner,
123 gfx::AcceleratedWidget widget,
124 const gfx::Size& size) {
125 return new CompositorCC(owner, widget, size);
126 }
127
128 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698