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 "content/browser/devtools/protocol/page_handler.h" | 5 #include "content/browser/devtools/protocol/page_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 | 138 |
139 void PageHandler::SetClient(std::unique_ptr<Client> client) { | 139 void PageHandler::SetClient(std::unique_ptr<Client> client) { |
140 client_.swap(client); | 140 client_.swap(client); |
141 } | 141 } |
142 | 142 |
143 void PageHandler::Detached() { | 143 void PageHandler::Detached() { |
144 Disable(); | 144 Disable(); |
145 } | 145 } |
146 | 146 |
147 void PageHandler::OnSwapCompositorFrame( | 147 void PageHandler::OnSwapCompositorFrame( |
148 const cc::CompositorFrameMetadata& frame_metadata) { | 148 cc::CompositorFrameMetadata frame_metadata) { |
149 last_compositor_frame_metadata_ = frame_metadata; | 149 last_compositor_frame_metadata_ = frame_metadata.Clone(); |
danakj
2016/06/24 20:20:43
why not move?
Fady Samuel
2016/06/24 21:31:15
Done.
| |
150 has_compositor_frame_metadata_ = true; | 150 has_compositor_frame_metadata_ = true; |
151 | 151 |
152 if (screencast_enabled_) | 152 if (screencast_enabled_) |
153 InnerSwapCompositorFrame(); | 153 InnerSwapCompositorFrame(); |
154 color_picker_->OnSwapCompositorFrame(); | 154 color_picker_->OnSwapCompositorFrame(); |
155 } | 155 } |
156 | 156 |
157 void PageHandler::OnSynchronousSwapCompositorFrame( | 157 void PageHandler::OnSynchronousSwapCompositorFrame( |
158 const cc::CompositorFrameMetadata& frame_metadata) { | 158 cc::CompositorFrameMetadata frame_metadata) { |
159 last_compositor_frame_metadata_ = has_compositor_frame_metadata_ ? | 159 last_compositor_frame_metadata_ = |
160 next_compositor_frame_metadata_ : frame_metadata; | 160 has_compositor_frame_metadata_ ? next_compositor_frame_metadata_.Clone() |
danakj
2016/06/24 20:20:43
you can move here, but you probably need to use if
Fady Samuel
2016/06/24 21:31:15
Done.
| |
161 next_compositor_frame_metadata_ = frame_metadata; | 161 : frame_metadata.Clone(); |
162 next_compositor_frame_metadata_ = std::move(frame_metadata); | |
162 has_compositor_frame_metadata_ = true; | 163 has_compositor_frame_metadata_ = true; |
163 | 164 |
164 if (screencast_enabled_) | 165 if (screencast_enabled_) |
165 InnerSwapCompositorFrame(); | 166 InnerSwapCompositorFrame(); |
166 color_picker_->OnSwapCompositorFrame(); | 167 color_picker_->OnSwapCompositorFrame(); |
167 } | 168 } |
168 | 169 |
169 void PageHandler::Observe(int type, | 170 void PageHandler::Observe(int type, |
170 const NotificationSource& source, | 171 const NotificationSource& source, |
171 const NotificationDetails& details) { | 172 const NotificationDetails& details) { |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
514 | 515 |
515 void PageHandler::OnColorPicked(int r, int g, int b, int a) { | 516 void PageHandler::OnColorPicked(int r, int g, int b, int a) { |
516 scoped_refptr<dom::RGBA> color = | 517 scoped_refptr<dom::RGBA> color = |
517 dom::RGBA::Create()->set_r(r)->set_g(g)->set_b(b)->set_a(a); | 518 dom::RGBA::Create()->set_r(r)->set_g(g)->set_b(b)->set_a(a); |
518 client_->ColorPicked(ColorPickedParams::Create()->set_color(color)); | 519 client_->ColorPicked(ColorPickedParams::Create()->set_color(color)); |
519 } | 520 } |
520 | 521 |
521 } // namespace page | 522 } // namespace page |
522 } // namespace devtools | 523 } // namespace devtools |
523 } // namespace content | 524 } // namespace content |
OLD | NEW |