| OLD | NEW | 
|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "remoting/host/capturer.h" | 5 #include "remoting/host/capturer.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 | 8 | 
|  | 9 #include "remoting/base/tracer.h" | 
|  | 10 | 
| 9 namespace remoting { | 11 namespace remoting { | 
| 10 | 12 | 
| 11 Capturer::Capturer() | 13 Capturer::Capturer() | 
| 12     : width_(0), | 14     : width_(0), | 
| 13       height_(0), | 15       height_(0), | 
| 14       pixel_format_(PixelFormatInvalid), | 16       pixel_format_(PixelFormatInvalid), | 
| 15       bytes_per_row_(0), | 17       bytes_per_row_(0), | 
| 16       current_buffer_(0) { | 18       current_buffer_(0) { | 
| 17 } | 19 } | 
| 18 | 20 | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 36 } | 38 } | 
| 37 | 39 | 
| 38 void Capturer::InvalidateFullScreen() { | 40 void Capturer::InvalidateFullScreen() { | 
| 39   AutoLock auto_inval_rects_lock(inval_rects_lock_); | 41   AutoLock auto_inval_rects_lock(inval_rects_lock_); | 
| 40   inval_rects_.clear(); | 42   inval_rects_.clear(); | 
| 41   inval_rects_.insert(gfx::Rect(0, 0, width_, height_)); | 43   inval_rects_.insert(gfx::Rect(0, 0, width_, height_)); | 
| 42 } | 44 } | 
| 43 | 45 | 
| 44 void Capturer::CaptureInvalidRects(CaptureCompletedCallback* callback) { | 46 void Capturer::CaptureInvalidRects(CaptureCompletedCallback* callback) { | 
| 45   // Calculate which rects need to be captured. | 47   // Calculate which rects need to be captured. | 
|  | 48   TraceContext::tracer()->PrintString("Started CalculateInvalidRects"); | 
| 46   CalculateInvalidRects(); | 49   CalculateInvalidRects(); | 
|  | 50   TraceContext::tracer()->PrintString("Done CalculateInvalidRects"); | 
| 47 | 51 | 
| 48   // Braced to scope the lock. | 52   // Braced to scope the lock. | 
| 49   InvalidRects local_rects; | 53   InvalidRects local_rects; | 
| 50   { | 54   { | 
| 51     AutoLock auto_inval_rects_lock(inval_rects_lock_); | 55     AutoLock auto_inval_rects_lock(inval_rects_lock_); | 
| 52     local_rects = inval_rects_; | 56     local_rects.swap(inval_rects_); | 
| 53     inval_rects_.clear(); |  | 
| 54   } | 57   } | 
| 55 | 58 | 
|  | 59   TraceContext::tracer()->PrintString("Start CaptureRects"); | 
| 56   CaptureRects(local_rects, callback); | 60   CaptureRects(local_rects, callback); | 
| 57 } | 61 } | 
| 58 | 62 | 
| 59 void Capturer::FinishCapture(scoped_refptr<CaptureData> data, | 63 void Capturer::FinishCapture(scoped_refptr<CaptureData> data, | 
| 60                              CaptureCompletedCallback* callback) { | 64                              CaptureCompletedCallback* callback) { | 
| 61   // Select the next buffer to be the current buffer. | 65   // Select the next buffer to be the current buffer. | 
| 62   current_buffer_ = (current_buffer_ + 1) % kNumBuffers; | 66   current_buffer_ = (current_buffer_ + 1) % kNumBuffers; | 
| 63 | 67 | 
| 64   callback->Run(data); | 68   callback->Run(data); | 
| 65   delete callback; | 69   delete callback; | 
| 66 } | 70 } | 
| 67 | 71 | 
| 68 }  // namespace remoting | 72 }  // namespace remoting | 
| OLD | NEW | 
|---|