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

Side by Side Diff: webkit/compositor_bindings/web_layer_tree_view_impl.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Apply code review comments Created 8 years, 1 month 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "config.h" 5 #include "config.h"
6 #include "web_layer_tree_view_impl.h" 6 #include "web_layer_tree_view_impl.h"
7 7
8 #include "cc/font_atlas.h" 8 #include "cc/font_atlas.h"
9 #include "cc/input_handler.h" 9 #include "cc/input_handler.h"
10 #include "cc/layer.h" 10 #include "cc/layer.h"
11 #include "cc/layer_tree_host.h" 11 #include "cc/layer_tree_host.h"
12 #include "cc/thread.h"
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h " 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h "
18 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
19 #include "web_layer_impl.h" 20 #include "web_layer_impl.h"
20 #include "web_to_ccinput_handler_adapter.h" 21 #include "web_to_ccinput_handler_adapter.h"
21 22
22 using namespace cc; 23 using namespace cc;
23 24
24 namespace WebKit { 25 namespace WebKit {
25 26
26 WebLayerTreeView* WebLayerTreeView::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings)
27 {
28 scoped_ptr<WebLayerTreeViewImpl> layerTreeViewImpl(new WebLayerTreeViewImpl( client));
29 if (!layerTreeViewImpl->initialize(settings))
30 return 0;
31 layerTreeViewImpl->setRootLayer(root);
32 return layerTreeViewImpl.release();
33 }
34
35 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client) 27 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client)
36 : m_client(client) 28 : m_client(client)
37 { 29 {
38 } 30 }
39 31
40 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() 32 WebLayerTreeViewImpl::~WebLayerTreeViewImpl()
41 { 33 {
42 } 34 }
43 35
44 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti ngs) 36 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti ngs, scoped_ptr<Thread> implThread)
45 { 37 {
46 LayerTreeSettings settings; 38 LayerTreeSettings settings;
47 settings.acceleratePainting = webSettings.acceleratePainting; 39 settings.acceleratePainting = webSettings.acceleratePainting;
48 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; 40 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree;
49 settings.showPaintRects = webSettings.showPaintRects; 41 settings.showPaintRects = webSettings.showPaintRects;
50 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; 42 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled;
51 settings.refreshRate = webSettings.refreshRate; 43 settings.refreshRate = webSettings.refreshRate;
52 settings.defaultTileSize = webSettings.defaultTileSize; 44 settings.defaultTileSize = webSettings.defaultTileSize;
53 settings.maxUntiledLayerSize = webSettings.maxUntiledLayerSize; 45 settings.maxUntiledLayerSize = webSettings.maxUntiledLayerSize;
54 m_layerTreeHost = LayerTreeHost::create(this, settings); 46 m_layerTreeHost = LayerTreeHost::create(this, settings, implThread.Pass());
55 if (!m_layerTreeHost.get()) 47 if (!m_layerTreeHost.get())
56 return false; 48 return false;
57 49
58 if (webSettings.showFPSCounter) 50 if (webSettings.showFPSCounter)
59 setShowFPSCounter(true); 51 setShowFPSCounter(true);
60 return true; 52 return true;
61 } 53 }
62 54
63 void WebLayerTreeViewImpl::setSurfaceReady() 55 void WebLayerTreeViewImpl::setSurfaceReady()
64 { 56 {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 m_layerTreeHost->setNeedsRedraw(); 136 m_layerTreeHost->setNeedsRedraw();
145 } 137 }
146 138
147 bool WebLayerTreeViewImpl::commitRequested() const 139 bool WebLayerTreeViewImpl::commitRequested() const
148 { 140 {
149 return m_layerTreeHost->commitRequested(); 141 return m_layerTreeHost->commitRequested();
150 } 142 }
151 143
152 void WebLayerTreeViewImpl::composite() 144 void WebLayerTreeViewImpl::composite()
153 { 145 {
154 if (Proxy::hasImplThread()) 146 m_layerTreeHost->composite();
155 m_layerTreeHost->setNeedsCommit();
156 else
157 m_layerTreeHost->composite();
158 } 147 }
159 148
160 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTimeSeconds) 149 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTimeSeconds)
161 { 150 {
162 base::TimeTicks frameBeginTime = base::TimeTicks::FromInternalValue(frameBeg inTimeSeconds * base::Time::kMicrosecondsPerSecond); 151 base::TimeTicks frameBeginTime = base::TimeTicks::FromInternalValue(frameBeg inTimeSeconds * base::Time::kMicrosecondsPerSecond);
163 m_layerTreeHost->updateAnimations(frameBeginTime); 152 m_layerTreeHost->updateAnimations(frameBeginTime);
164 } 153 }
165 154
166 bool WebLayerTreeViewImpl::compositeAndReadback(void *pixels, const WebRect& rec t) 155 bool WebLayerTreeViewImpl::compositeAndReadback(void *pixels, const WebRect& rec t)
167 { 156 {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 { 269 {
281 m_client->didCompleteSwapBuffers(); 270 m_client->didCompleteSwapBuffers();
282 } 271 }
283 272
284 void WebLayerTreeViewImpl::scheduleComposite() 273 void WebLayerTreeViewImpl::scheduleComposite()
285 { 274 {
286 m_client->scheduleComposite(); 275 m_client->scheduleComposite();
287 } 276 }
288 277
289 } // namespace WebKit 278 } // namespace WebKit
OLDNEW
« no previous file with comments | « webkit/compositor_bindings/web_layer_tree_view_impl.h ('k') | webkit/compositor_bindings/web_layer_tree_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698