OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/html_viewer/web_layer_tree_view_impl.h" | 5 #include "components/html_viewer/web_layer_tree_view_impl.h" |
6 | 6 |
7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "cc/blink/web_layer_impl.h" | 8 #include "cc/blink/web_layer_impl.h" |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/output/begin_frame_args.h" | 10 #include "cc/output/begin_frame_args.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 scoped_refptr<cc::ContextProvider> context_provider( | 65 scoped_refptr<cc::ContextProvider> context_provider( |
66 new mojo::ContextProviderMojo(cb.PassInterface().PassHandle())); | 66 new mojo::ContextProviderMojo(cb.PassInterface().PassHandle())); |
67 output_surface_.reset( | 67 output_surface_.reset( |
68 new mojo::OutputSurfaceMojo(this, context_provider, | 68 new mojo::OutputSurfaceMojo(this, context_provider, |
69 surface.PassInterface().PassHandle())); | 69 surface.PassInterface().PassHandle())); |
70 } | 70 } |
71 layer_tree_host_->SetLayerTreeHostClientReady(); | 71 layer_tree_host_->SetLayerTreeHostClientReady(); |
72 } | 72 } |
73 | 73 |
74 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() { | 74 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() { |
| 75 // Destroy the LayerTreeHost before anything else as doing so ensures we're |
| 76 // not accessed on the compositor thread (we are the LayerTreeHostClient). |
| 77 layer_tree_host_.reset(); |
75 } | 78 } |
76 | 79 |
77 void WebLayerTreeViewImpl::WillBeginMainFrame() { | 80 void WebLayerTreeViewImpl::WillBeginMainFrame() { |
78 } | 81 } |
79 | 82 |
80 void WebLayerTreeViewImpl::DidBeginMainFrame() { | 83 void WebLayerTreeViewImpl::DidBeginMainFrame() { |
81 } | 84 } |
82 | 85 |
83 void WebLayerTreeViewImpl::BeginMainFrameNotExpectedSoon() { | 86 void WebLayerTreeViewImpl::BeginMainFrameNotExpectedSoon() { |
84 } | 87 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 base::Bind(&WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread, | 247 base::Bind(&WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread, |
245 main_thread_bound_weak_ptr_, | 248 main_thread_bound_weak_ptr_, |
246 id)); | 249 id)); |
247 } | 250 } |
248 | 251 |
249 void WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread(cc::SurfaceId id) { | 252 void WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread(cc::SurfaceId id) { |
250 view_->SetSurfaceId(mojo::SurfaceId::From(id)); | 253 view_->SetSurfaceId(mojo::SurfaceId::From(id)); |
251 } | 254 } |
252 | 255 |
253 } // namespace html_viewer | 256 } // namespace html_viewer |
OLD | NEW |