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

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

Issue 11369071: A speculative Revert for r165872 - Remove static thread pointers from CC, attempt 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 | Annotate | Revision Log
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"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h"
18 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h " 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h "
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
20 #include "webcore_convert.h" 19 #include "webcore_convert.h"
21 #include "web_layer_impl.h" 20 #include "web_layer_impl.h"
22 #include "web_to_ccinput_handler_adapter.h" 21 #include "web_to_ccinput_handler_adapter.h"
23 22
24 using namespace cc; 23 using namespace cc;
25 24
26 namespace WebKit { 25 namespace WebKit {
27 26
28 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)
29 { 28 {
30 scoped_ptr<WebLayerTreeViewImpl> layerTreeViewImpl(new WebLayerTreeViewImpl( client)); 29 scoped_ptr<WebLayerTreeViewImpl> layerTreeViewImpl(new WebLayerTreeViewImpl( client));
31 if (!layerTreeViewImpl->initialize(settings, scoped_ptr<Thread>(NULL))) 30 if (!layerTreeViewImpl->initialize(settings))
32 return 0; 31 return 0;
33 layerTreeViewImpl->setRootLayer(root); 32 layerTreeViewImpl->setRootLayer(root);
34 return layerTreeViewImpl.release(); 33 return layerTreeViewImpl.release();
35 } 34 }
36 35
37 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client) 36 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client)
38 : m_client(client) 37 : m_client(client)
39 , m_hasImplThread(false)
40 { 38 {
41 } 39 }
42 40
43 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() 41 WebLayerTreeViewImpl::~WebLayerTreeViewImpl()
44 { 42 {
45 } 43 }
46 44
47 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti ngs, scoped_ptr<Thread> implThread) 45 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti ngs)
48 { 46 {
49 LayerTreeSettings settings; 47 LayerTreeSettings settings;
50 settings.acceleratePainting = webSettings.acceleratePainting; 48 settings.acceleratePainting = webSettings.acceleratePainting;
51 settings.showFPSCounter = webSettings.showFPSCounter; 49 settings.showFPSCounter = webSettings.showFPSCounter;
52 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; 50 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree;
53 settings.showPaintRects = webSettings.showPaintRects; 51 settings.showPaintRects = webSettings.showPaintRects;
54 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; 52 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled;
55 settings.refreshRate = webSettings.refreshRate; 53 settings.refreshRate = webSettings.refreshRate;
56 settings.defaultTileSize = webSettings.defaultTileSize; 54 settings.defaultTileSize = webSettings.defaultTileSize;
57 settings.maxUntiledLayerSize = webSettings.maxUntiledLayerSize; 55 settings.maxUntiledLayerSize = webSettings.maxUntiledLayerSize;
58 m_layerTreeHost = LayerTreeHost::create(this, settings, implThread.Pass()); 56 m_layerTreeHost = LayerTreeHost::create(this, settings);
59 if (implThread)
60 m_hasImplThread = true;
61 if (!m_layerTreeHost.get()) 57 if (!m_layerTreeHost.get())
62 return false; 58 return false;
63 return true; 59 return true;
64 } 60 }
65 61
66 void WebLayerTreeViewImpl::setSurfaceReady() 62 void WebLayerTreeViewImpl::setSurfaceReady()
67 { 63 {
68 m_layerTreeHost->setSurfaceReady(); 64 m_layerTreeHost->setSurfaceReady();
69 } 65 }
70 66
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 m_layerTreeHost->setNeedsRedraw(); 143 m_layerTreeHost->setNeedsRedraw();
148 } 144 }
149 145
150 bool WebLayerTreeViewImpl::commitRequested() const 146 bool WebLayerTreeViewImpl::commitRequested() const
151 { 147 {
152 return m_layerTreeHost->commitRequested(); 148 return m_layerTreeHost->commitRequested();
153 } 149 }
154 150
155 void WebLayerTreeViewImpl::composite() 151 void WebLayerTreeViewImpl::composite()
156 { 152 {
157 if (m_hasImplThread) 153 if (Proxy::hasImplThread())
158 m_layerTreeHost->setNeedsCommit(); 154 m_layerTreeHost->setNeedsCommit();
159 else 155 else
160 m_layerTreeHost->composite(); 156 m_layerTreeHost->composite();
161 } 157 }
162 158
163 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTimeSeconds) 159 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTimeSeconds)
164 { 160 {
165 base::TimeTicks frameBeginTime = base::TimeTicks::FromInternalValue(frameBeg inTimeSeconds * base::Time::kMicrosecondsPerSecond); 161 base::TimeTicks frameBeginTime = base::TimeTicks::FromInternalValue(frameBeg inTimeSeconds * base::Time::kMicrosecondsPerSecond);
166 m_layerTreeHost->updateAnimations(frameBeginTime); 162 m_layerTreeHost->updateAnimations(frameBeginTime);
167 } 163 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 { 274 {
279 m_client->didCompleteSwapBuffers(); 275 m_client->didCompleteSwapBuffers();
280 } 276 }
281 277
282 void WebLayerTreeViewImpl::scheduleComposite() 278 void WebLayerTreeViewImpl::scheduleComposite()
283 { 279 {
284 m_client->scheduleComposite(); 280 m_client->scheduleComposite();
285 } 281 }
286 282
287 } // namespace WebKit 283 } // 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