summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 22:31:12 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 22:31:12 +0000
commit4a7f66576f3f8652f7ba25b795411b1a023e418c (patch)
tree4a71761eb7a14c5034502fbcebb7d28fe9f4d990 /remoting
parente3863b1623afa678ee72bd20796fb6c35219312f (diff)
downloadchromium_src-4a7f66576f3f8652f7ba25b795411b1a023e418c.zip
chromium_src-4a7f66576f3f8652f7ba25b795411b1a023e418c.tar.gz
chromium_src-4a7f66576f3f8652f7ba25b795411b1a023e418c.tar.bz2
Check CreateDIBSection() result in VideoFrameCapturerWin.
This causes us to CHECK if framebuffer allocation fails, rather than crashing when we try to access the buffer's pixel data. BUG=157170 Review URL: https://chromiumcodereview.appspot.com/11365056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165776 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/video_frame_capturer_win.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/remoting/host/video_frame_capturer_win.cc b/remoting/host/video_frame_capturer_win.cc
index 23b8496..3f40592 100644
--- a/remoting/host/video_frame_capturer_win.cc
+++ b/remoting/host/video_frame_capturer_win.cc
@@ -67,7 +67,7 @@ class VideoFrameCapturerWin : public VideoFrameCapturer {
int resource_generation;
};
- // Make sure that the device contexts and the current bufffer match the screen
+ // Make sure that the device contexts and the current buffer match the screen
// configuration.
void PrepareCaptureResources();
@@ -75,11 +75,16 @@ class VideoFrameCapturerWin : public VideoFrameCapturer {
// and desktop dimensions, releasing any pre-existing buffer.
void AllocateBuffer(int buffer_index, int resource_generation);
+ // Compares the most recently captured screen contents with the previous
+ // contents reported to the caller, to determine the dirty region.
void CalculateInvalidRegion();
+
+ // Creates a CaptureData instance wrapping the current framebuffer and calls
+ // |callback| with it.
void CaptureRegion(const SkRegion& region,
const CaptureCompletedCallback& callback);
- // Generates an image in the current buffer.
+ // Captures the current screen contents into the next available framebuffer.
void CaptureImage();
// Expand the cursor shape to add a white outline for visibility against
@@ -292,6 +297,11 @@ void VideoFrameCapturerWin::AllocateBuffer(int buffer_index,
CreateDIBSection(*desktop_dc_, &bmi, DIB_RGB_COLORS,
static_cast<void**>(&buffers_[buffer_index].data),
NULL, 0);
+
+ // TODO(wez): Cope gracefully with failure (crbug.com/157170).
+ CHECK(target_bitmap_[buffer_index] != NULL);
+ CHECK(buffers_[buffer_index].data != NULL);
+
buffers_[buffer_index].size = SkISize::Make(bmi.bmiHeader.biWidth,
std::abs(bmi.bmiHeader.biHeight));
buffers_[buffer_index].bytes_per_pixel = bmi.bmiHeader.biBitCount / 8;