blob: 90ece041bdc37d8762a0c958b018401daaa36632 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// 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/bind.h"
#include "base/callback_helpers.h"
#include "base/logging.h"
#include "cc/output/copy_output_result.h"
#include "cc/resources/texture_mailbox.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace cc {
CopyOutputRequest::CopyOutputRequest() {}
CopyOutputRequest::CopyOutputRequest(
bool force_bitmap_result,
const CopyOutputRequestCallback& result_callback)
: force_bitmap_result_(force_bitmap_result),
result_callback_(result_callback) {
}
CopyOutputRequest::~CopyOutputRequest() {
if (!result_callback_.is_null())
SendResult(CopyOutputResult::CreateEmptyResult().Pass());
}
void CopyOutputRequest::SendResult(scoped_ptr<CopyOutputResult> result) {
base::ResetAndReturn(&result_callback_).Run(result.Pass());
}
void CopyOutputRequest::SendBitmapResult(scoped_ptr<SkBitmap> bitmap) {
SendResult(CopyOutputResult::CreateBitmapResult(bitmap.Pass()).Pass());
}
void CopyOutputRequest::SendTextureResult(gfx::Size size,
scoped_ptr<TextureMailbox> texture) {
DCHECK(texture->IsTexture());
SendResult(CopyOutputResult::CreateTextureResult(size,
texture.Pass()).Pass());
}
} // namespace cc
|