blob: 437cce546abe040bd2a7be69d2a16bc5032eaf67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/output/copy_output_request.h"
#include "base/callback_helpers.h"
#include "base/logging.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace cc {
CopyOutputRequest::CopyOutputRequest(const CopyAsBitmapCallback& callback)
: bitmap_callback_(callback) {}
CopyOutputRequest::~CopyOutputRequest() {
SendEmptyResult();
}
void CopyOutputRequest::SendEmptyResult() {
if (!bitmap_callback_.is_null())
base::ResetAndReturn(&bitmap_callback_).Run(scoped_ptr<SkBitmap>());
}
void CopyOutputRequest::SendBitmapResult(scoped_ptr<SkBitmap> bitmap) {
DCHECK(HasBitmapRequest());
base::ResetAndReturn(&bitmap_callback_).Run(bitmap.Pass());
}
} // namespace cc
|