OLD | NEW |
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 "webcore_convert.h" | 20 #include "webcore_convert.h" |
20 #include "web_layer_impl.h" | 21 #include "web_layer_impl.h" |
21 #include "web_to_ccinput_handler_adapter.h" | 22 #include "web_to_ccinput_handler_adapter.h" |
22 | 23 |
23 using namespace cc; | 24 using namespace cc; |
24 | 25 |
25 namespace WebKit { | 26 namespace WebKit { |
26 | 27 |
27 WebLayerTreeView* WebLayerTreeView::create(WebLayerTreeViewClient* client, const
WebLayer& root, const WebLayerTreeView::Settings& settings) | 28 WebLayerTreeView* WebLayerTreeView::create(WebLayerTreeViewClient* client, const
WebLayer& root, const WebLayerTreeView::Settings& settings) |
28 { | 29 { |
29 scoped_ptr<WebLayerTreeViewImpl> layerTreeViewImpl(new WebLayerTreeViewImpl(
client)); | 30 scoped_ptr<WebLayerTreeViewImpl> layerTreeViewImpl(new WebLayerTreeViewImpl(
client)); |
30 if (!layerTreeViewImpl->initialize(settings)) | 31 if (!layerTreeViewImpl->initialize(settings, scoped_ptr<Thread>(NULL))) |
31 return 0; | 32 return 0; |
32 layerTreeViewImpl->setRootLayer(root); | 33 layerTreeViewImpl->setRootLayer(root); |
33 return layerTreeViewImpl.release(); | 34 return layerTreeViewImpl.release(); |
34 } | 35 } |
35 | 36 |
36 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client) | 37 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client) |
37 : m_client(client) | 38 : m_client(client) |
| 39 , m_hasImplThread(false) |
38 { | 40 { |
39 } | 41 } |
40 | 42 |
41 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() | 43 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() |
42 { | 44 { |
43 } | 45 } |
44 | 46 |
45 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti
ngs) | 47 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti
ngs, scoped_ptr<Thread> implThread) |
46 { | 48 { |
47 LayerTreeSettings settings; | 49 LayerTreeSettings settings; |
48 settings.acceleratePainting = webSettings.acceleratePainting; | 50 settings.acceleratePainting = webSettings.acceleratePainting; |
49 settings.showFPSCounter = webSettings.showFPSCounter; | 51 settings.showFPSCounter = webSettings.showFPSCounter; |
50 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; | 52 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; |
51 settings.showPaintRects = webSettings.showPaintRects; | 53 settings.showPaintRects = webSettings.showPaintRects; |
52 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; | 54 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; |
53 settings.refreshRate = webSettings.refreshRate; | 55 settings.refreshRate = webSettings.refreshRate; |
54 settings.defaultTileSize = webSettings.defaultTileSize; | 56 settings.defaultTileSize = webSettings.defaultTileSize; |
55 settings.maxUntiledLayerSize = webSettings.maxUntiledLayerSize; | 57 settings.maxUntiledLayerSize = webSettings.maxUntiledLayerSize; |
56 m_layerTreeHost = LayerTreeHost::create(this, settings); | 58 m_layerTreeHost = LayerTreeHost::create(this, settings, implThread.Pass()); |
| 59 if (implThread) |
| 60 m_hasImplThread = true; |
57 if (!m_layerTreeHost.get()) | 61 if (!m_layerTreeHost.get()) |
58 return false; | 62 return false; |
59 return true; | 63 return true; |
60 } | 64 } |
61 | 65 |
62 void WebLayerTreeViewImpl::setSurfaceReady() | 66 void WebLayerTreeViewImpl::setSurfaceReady() |
63 { | 67 { |
64 m_layerTreeHost->setSurfaceReady(); | 68 m_layerTreeHost->setSurfaceReady(); |
65 } | 69 } |
66 | 70 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 m_layerTreeHost->setNeedsRedraw(); | 147 m_layerTreeHost->setNeedsRedraw(); |
144 } | 148 } |
145 | 149 |
146 bool WebLayerTreeViewImpl::commitRequested() const | 150 bool WebLayerTreeViewImpl::commitRequested() const |
147 { | 151 { |
148 return m_layerTreeHost->commitRequested(); | 152 return m_layerTreeHost->commitRequested(); |
149 } | 153 } |
150 | 154 |
151 void WebLayerTreeViewImpl::composite() | 155 void WebLayerTreeViewImpl::composite() |
152 { | 156 { |
153 if (Proxy::hasImplThread()) | 157 if (m_hasImplThread) |
154 m_layerTreeHost->setNeedsCommit(); | 158 m_layerTreeHost->setNeedsCommit(); |
155 else | 159 else |
156 m_layerTreeHost->composite(); | 160 m_layerTreeHost->composite(); |
157 } | 161 } |
158 | 162 |
159 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTimeSeconds) | 163 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTimeSeconds) |
160 { | 164 { |
161 base::TimeTicks frameBeginTime = base::TimeTicks::FromInternalValue(frameBeg
inTimeSeconds * base::Time::kMicrosecondsPerSecond); | 165 base::TimeTicks frameBeginTime = base::TimeTicks::FromInternalValue(frameBeg
inTimeSeconds * base::Time::kMicrosecondsPerSecond); |
162 m_layerTreeHost->updateAnimations(frameBeginTime); | 166 m_layerTreeHost->updateAnimations(frameBeginTime); |
163 } | 167 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 { | 274 { |
271 m_client->didCompleteSwapBuffers(); | 275 m_client->didCompleteSwapBuffers(); |
272 } | 276 } |
273 | 277 |
274 void WebLayerTreeViewImpl::scheduleComposite() | 278 void WebLayerTreeViewImpl::scheduleComposite() |
275 { | 279 { |
276 m_client->scheduleComposite(); | 280 m_client->scheduleComposite(); |
277 } | 281 } |
278 | 282 |
279 } // namespace WebKit | 283 } // namespace WebKit |
OLD | NEW |