OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/media/capture/desktop_capture_device_aura.h" | 5 #include "content/browser/media/capture/desktop_capture_device_aura.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 220 |
221 power_save_blocker_.reset(PowerSaveBlocker::Create( | 221 power_save_blocker_.reset(PowerSaveBlocker::Create( |
222 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 222 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
223 "DesktopCaptureDevice is running").release()); | 223 "DesktopCaptureDevice is running").release()); |
224 | 224 |
225 // Starts timer. | 225 // Starts timer. |
226 timer_.Start(FROM_HERE, oracle_proxy_->min_capture_period(), | 226 timer_.Start(FROM_HERE, oracle_proxy_->min_capture_period(), |
227 base::Bind(&DesktopVideoCaptureMachine::Capture, AsWeakPtr(), | 227 base::Bind(&DesktopVideoCaptureMachine::Capture, AsWeakPtr(), |
228 false)); | 228 false)); |
229 | 229 |
230 started_ = true; | |
231 return true; | 230 return true; |
232 } | 231 } |
233 | 232 |
234 void DesktopVideoCaptureMachine::Stop(const base::Closure& callback) { | 233 void DesktopVideoCaptureMachine::Stop(const base::Closure& callback) { |
235 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
236 power_save_blocker_.reset(); | 235 power_save_blocker_.reset(); |
237 | 236 |
238 // Stop observing compositor and window events. | 237 // Stop observing compositor and window events. |
239 if (desktop_window_) { | 238 if (desktop_window_) { |
240 if (desktop_window_->GetHost()) | 239 if (desktop_window_->GetHost()) |
241 desktop_window_->GetHost()->compositor()->RemoveObserver(this); | 240 desktop_window_->GetHost()->compositor()->RemoveObserver(this); |
242 desktop_window_->RemoveObserver(this); | 241 desktop_window_->RemoveObserver(this); |
243 desktop_window_ = NULL; | 242 desktop_window_ = NULL; |
244 } | 243 } |
245 | 244 |
246 // Stop timer. | 245 // Stop timer. |
247 timer_.Stop(); | 246 timer_.Stop(); |
248 | 247 |
249 started_ = false; | |
250 | |
251 callback.Run(); | 248 callback.Run(); |
252 } | 249 } |
253 | 250 |
254 void DesktopVideoCaptureMachine::UpdateCaptureSize() { | 251 void DesktopVideoCaptureMachine::UpdateCaptureSize() { |
255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
256 if (oracle_proxy_.get() && desktop_window_) { | 253 if (oracle_proxy_.get() && desktop_window_) { |
257 ui::Layer* layer = desktop_window_->layer(); | 254 ui::Layer* layer = desktop_window_->layer(); |
258 gfx::Size capture_size = | 255 gfx::Size capture_size = |
259 ui::ConvertSizeToPixel(layer, layer->bounds().size()); | 256 ui::ConvertSizeToPixel(layer, layer->bounds().size()); |
260 #if defined(OS_CHROMEOS) | 257 #if defined(OS_CHROMEOS) |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 scoped_ptr<Client> client) { | 536 scoped_ptr<Client> client) { |
540 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 537 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
541 core_->AllocateAndStart(params, client.Pass()); | 538 core_->AllocateAndStart(params, client.Pass()); |
542 } | 539 } |
543 | 540 |
544 void DesktopCaptureDeviceAura::StopAndDeAllocate() { | 541 void DesktopCaptureDeviceAura::StopAndDeAllocate() { |
545 core_->StopAndDeAllocate(); | 542 core_->StopAndDeAllocate(); |
546 } | 543 } |
547 | 544 |
548 } // namespace content | 545 } // namespace content |
OLD | NEW |