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

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 "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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 m_layerTreeHost->setNeedsRedraw(); 141 m_layerTreeHost->setNeedsRedraw();
139 } 142 }
140 143
141 bool WebLayerTreeViewImpl::commitRequested() const 144 bool WebLayerTreeViewImpl::commitRequested() const
142 { 145 {
143 return m_layerTreeHost->commitRequested(); 146 return m_layerTreeHost->commitRequested();
144 } 147 }
145 148
146 void WebLayerTreeViewImpl::composite() 149 void WebLayerTreeViewImpl::composite()
147 { 150 {
148 if (Proxy::hasImplThread()) 151 if (m_hasImplThread)
149 m_layerTreeHost->setNeedsCommit(); 152 m_layerTreeHost->setNeedsCommit();
150 else 153 else
151 m_layerTreeHost->composite(); 154 m_layerTreeHost->composite();
152 } 155 }
153 156
154 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTimeSeconds) 157 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTimeSeconds)
155 { 158 {
156 base::TimeTicks frameBeginTime = base::TimeTicks::FromInternalValue(frameBeg inTimeSeconds * base::Time::kMicrosecondsPerSecond); 159 base::TimeTicks frameBeginTime = base::TimeTicks::FromInternalValue(frameBeg inTimeSeconds * base::Time::kMicrosecondsPerSecond);
157 m_layerTreeHost->updateAnimations(frameBeginTime); 160 m_layerTreeHost->updateAnimations(frameBeginTime);
158 } 161 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 { 268 {
266 m_client->didCompleteSwapBuffers(); 269 m_client->didCompleteSwapBuffers();
267 } 270 }
268 271
269 void WebLayerTreeViewImpl::scheduleComposite() 272 void WebLayerTreeViewImpl::scheduleComposite()
270 { 273 {
271 m_client->scheduleComposite(); 274 m_client->scheduleComposite();
272 } 275 }
273 276
274 } // namespace WebKit 277 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698