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

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: Address code review comments and fix all cc_unittests 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 "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h " 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h "
18 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
19 #include "webcore_convert.h" 19 #include "webcore_convert.h"
20 #include "web_layer_impl.h" 20 #include "web_layer_impl.h"
21 #include "web_to_ccinput_handler_adapter.h" 21 #include "web_to_ccinput_handler_adapter.h"
22 22
23 using namespace cc; 23 using namespace cc;
24 24
25 namespace WebKit { 25 namespace WebKit {
26 26
27 WebLayerTreeView* WebLayerTreeView::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings) 27 WebLayerTreeView* WebLayerTreeView::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings)
28 { 28 {
29 scoped_ptr<WebLayerTreeViewImpl> layerTreeViewImpl(new WebLayerTreeViewImpl( client)); 29 scoped_ptr<WebLayerTreeViewImpl> layerTreeViewImpl(new WebLayerTreeViewImpl( client));
30 if (!layerTreeViewImpl->initialize(settings)) 30 if (!layerTreeViewImpl->initialize(settings, NULL))
31 return 0; 31 return 0;
32 layerTreeViewImpl->setRootLayer(root); 32 layerTreeViewImpl->setRootLayer(root);
33 return layerTreeViewImpl.release(); 33 return layerTreeViewImpl.release();
34 } 34 }
35 35
36 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client) 36 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client)
37 : m_client(client) 37 : m_client(client)
38 , m_hasImplThread(false)
38 { 39 {
39 } 40 }
40 41
41 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() 42 WebLayerTreeViewImpl::~WebLayerTreeViewImpl()
42 { 43 {
43 } 44 }
44 45
45 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti ngs) 46 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti ngs, Thread* implThread)
46 { 47 {
47 LayerTreeSettings settings; 48 LayerTreeSettings settings;
48 settings.acceleratePainting = webSettings.acceleratePainting; 49 settings.acceleratePainting = webSettings.acceleratePainting;
49 settings.showFPSCounter = webSettings.showFPSCounter; 50 settings.showFPSCounter = webSettings.showFPSCounter;
50 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; 51 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree;
51 settings.showPaintRects = webSettings.showPaintRects; 52 settings.showPaintRects = webSettings.showPaintRects;
52 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; 53 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled;
53 settings.refreshRate = webSettings.refreshRate; 54 settings.refreshRate = webSettings.refreshRate;
54 settings.defaultTileSize = convert(webSettings.defaultTileSize); 55 settings.defaultTileSize = convert(webSettings.defaultTileSize);
55 settings.maxUntiledLayerSize = convert(webSettings.maxUntiledLayerSize); 56 settings.maxUntiledLayerSize = convert(webSettings.maxUntiledLayerSize);
56 m_layerTreeHost = LayerTreeHost::create(this, settings); 57 m_layerTreeHost = LayerTreeHost::create(this, settings, implThread);
58 if (implThread)
59 m_hasImplThread = true;
57 if (!m_layerTreeHost.get()) 60 if (!m_layerTreeHost.get())
58 return false; 61 return false;
59 return true; 62 return true;
60 } 63 }
61 64
62 void WebLayerTreeViewImpl::setSurfaceReady() 65 void WebLayerTreeViewImpl::setSurfaceReady()
63 { 66 {
64 m_layerTreeHost->setSurfaceReady(); 67 m_layerTreeHost->setSurfaceReady();
65 } 68 }
66 69
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 m_layerTreeHost->setNeedsRedraw(); 140 m_layerTreeHost->setNeedsRedraw();
138 } 141 }
139 142
140 bool WebLayerTreeViewImpl::commitRequested() const 143 bool WebLayerTreeViewImpl::commitRequested() const
141 { 144 {
142 return m_layerTreeHost->commitRequested(); 145 return m_layerTreeHost->commitRequested();
143 } 146 }
144 147
145 void WebLayerTreeViewImpl::composite() 148 void WebLayerTreeViewImpl::composite()
146 { 149 {
147 if (Proxy::hasImplThread()) 150 if (m_hasImplThread)
148 m_layerTreeHost->setNeedsCommit(); 151 m_layerTreeHost->setNeedsCommit();
149 else 152 else
150 m_layerTreeHost->composite(); 153 m_layerTreeHost->composite();
151 } 154 }
152 155
153 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTime) 156 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTime)
154 { 157 {
155 m_layerTreeHost->updateAnimations(frameBeginTime); 158 m_layerTreeHost->updateAnimations(frameBeginTime);
156 } 159 }
157 160
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 { 261 {
259 m_client->didCompleteSwapBuffers(); 262 m_client->didCompleteSwapBuffers();
260 } 263 }
261 264
262 void WebLayerTreeViewImpl::scheduleComposite() 265 void WebLayerTreeViewImpl::scheduleComposite()
263 { 266 {
264 m_client->scheduleComposite(); 267 m_client->scheduleComposite();
265 } 268 }
266 269
267 } // namespace WebKit 270 } // namespace WebKit
OLDNEW
« cc/video_layer_impl.h ('K') | « webkit/compositor_bindings/web_layer_tree_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698