| 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 "sky/viewer/document_view.h" | 5 #include "sky/viewer/document_view.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 DocumentView::DocumentView( | 73 DocumentView::DocumentView( |
| 74 mojo::ServiceProviderPtr provider, | 74 mojo::ServiceProviderPtr provider, |
| 75 mojo::URLResponsePtr response, | 75 mojo::URLResponsePtr response, |
| 76 mojo::Shell* shell) | 76 mojo::Shell* shell) |
| 77 : response_(response.Pass()), | 77 : response_(response.Pass()), |
| 78 shell_(shell), | 78 shell_(shell), |
| 79 web_view_(NULL), | 79 web_view_(NULL), |
| 80 root_(NULL), | 80 root_(NULL), |
| 81 view_manager_client_factory_(shell_, this), | 81 view_manager_client_factory_(shell_, this), |
| 82 inspector_service_factory_(this), | 82 inspector_service_factory_(this), |
| 83 debugger_id_(s_next_debugger_id++), | 83 weak_factory_(this), |
| 84 weak_factory_(this) { | 84 debugger_id_(s_next_debugger_id++) { |
| 85 exported_services_.AddService(&view_manager_client_factory_); | 85 exported_services_.AddService(&view_manager_client_factory_); |
| 86 mojo::WeakBindToPipe(&exported_services_, provider.PassMessagePipe()); | 86 mojo::WeakBindToPipe(&exported_services_, provider.PassMessagePipe()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 DocumentView::~DocumentView() { | 89 DocumentView::~DocumentView() { |
| 90 if (web_view_) | 90 if (web_view_) |
| 91 web_view_->close(); | 91 web_view_->close(); |
| 92 if (root_) | 92 if (root_) |
| 93 root_->RemoveObserver(this); | 93 root_->RemoveObserver(this); |
| 94 } | 94 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 web_view_->setMainFrame(blink::WebLocalFrame::create(this)); | 128 web_view_->setMainFrame(blink::WebLocalFrame::create(this)); |
| 129 web_view_->mainFrame()->load(GURL(response->url), response->body.Pass()); | 129 web_view_->mainFrame()->load(GURL(response->url), response->body.Pass()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void DocumentView::initializeLayerTreeView() { | 132 void DocumentView::initializeLayerTreeView() { |
| 133 layer_host_.reset(new LayerHost(this)); | 133 layer_host_.reset(new LayerHost(this)); |
| 134 root_layer_ = make_scoped_refptr(new Layer(this)); | 134 root_layer_ = make_scoped_refptr(new Layer(this)); |
| 135 layer_host_->SetRootLayer(root_layer_); | 135 layer_host_->SetRootLayer(root_layer_); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void DocumentView::GetPixelsForTesting(std::vector<unsigned char>* pixels) { |
| 139 return layer_host_->GetPixelsForTesting(pixels); |
| 140 } |
| 141 |
| 138 mojo::Shell* DocumentView::GetShell() { | 142 mojo::Shell* DocumentView::GetShell() { |
| 139 return shell_; | 143 return shell_; |
| 140 } | 144 } |
| 141 | 145 |
| 142 void DocumentView::BeginFrame(base::TimeTicks frame_time) { | 146 void DocumentView::BeginFrame(base::TimeTicks frame_time) { |
| 143 double frame_time_sec = (frame_time - base::TimeTicks()).InSecondsF(); | 147 double frame_time_sec = (frame_time - base::TimeTicks()).InSecondsF(); |
| 144 double deadline_sec = frame_time_sec; | 148 double deadline_sec = frame_time_sec; |
| 145 double interval_sec = 1.0/60; | 149 double interval_sec = 1.0/60; |
| 146 blink::WebBeginFrameArgs web_begin_frame_args( | 150 blink::WebBeginFrameArgs web_begin_frame_args( |
| 147 frame_time_sec, deadline_sec, interval_sec); | 151 frame_time_sec, deadline_sec, interval_sec); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 void DocumentView::StartDebuggerInspectorBackend() { | 277 void DocumentView::StartDebuggerInspectorBackend() { |
| 274 if (!inspector_backend_) { | 278 if (!inspector_backend_) { |
| 275 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); | 279 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); |
| 276 inspector_backend_.reset( | 280 inspector_backend_.reset( |
| 277 new inspector::InspectorBackendMojo(inspector_host_.get())); | 281 new inspector::InspectorBackendMojo(inspector_host_.get())); |
| 278 } | 282 } |
| 279 inspector_backend_->Connect(); | 283 inspector_backend_->Connect(); |
| 280 } | 284 } |
| 281 | 285 |
| 282 } // namespace sky | 286 } // namespace sky |
| OLD | NEW |