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 "cc/output/copy_output_request.h" | 5 #include "cc/output/copy_output_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "cc/output/copy_output_result.h" | 10 #include "cc/output/copy_output_result.h" |
11 #include "cc/resources/texture_mailbox.h" | 11 #include "cc/resources/texture_mailbox.h" |
12 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 CopyOutputRequest::CopyOutputRequest() {} | 16 CopyOutputRequest::CopyOutputRequest() {} |
17 | 17 |
18 CopyOutputRequest::CopyOutputRequest( | 18 CopyOutputRequest::CopyOutputRequest( |
19 bool force_bitmap_result, | 19 bool force_bitmap_result, |
20 const CopyOutputRequestCallback& result_callback) | 20 const CopyOutputRequestCallback& result_callback) |
21 : force_bitmap_result_(force_bitmap_result), | 21 : force_bitmap_result_(force_bitmap_result), |
| 22 has_area_(false), |
22 result_callback_(result_callback) { | 23 result_callback_(result_callback) { |
23 } | 24 } |
24 | 25 |
25 CopyOutputRequest::~CopyOutputRequest() { | 26 CopyOutputRequest::~CopyOutputRequest() { |
26 if (!result_callback_.is_null()) | 27 if (!result_callback_.is_null()) |
27 SendResult(CopyOutputResult::CreateEmptyResult().Pass()); | 28 SendResult(CopyOutputResult::CreateEmptyResult().Pass()); |
28 } | 29 } |
29 | 30 |
30 void CopyOutputRequest::SendResult(scoped_ptr<CopyOutputResult> result) { | 31 void CopyOutputRequest::SendResult(scoped_ptr<CopyOutputResult> result) { |
31 base::ResetAndReturn(&result_callback_).Run(result.Pass()); | 32 base::ResetAndReturn(&result_callback_).Run(result.Pass()); |
32 } | 33 } |
33 | 34 |
34 void CopyOutputRequest::SendBitmapResult(scoped_ptr<SkBitmap> bitmap) { | 35 void CopyOutputRequest::SendBitmapResult(scoped_ptr<SkBitmap> bitmap) { |
35 SendResult(CopyOutputResult::CreateBitmapResult(bitmap.Pass()).Pass()); | 36 SendResult(CopyOutputResult::CreateBitmapResult(bitmap.Pass()).Pass()); |
36 } | 37 } |
37 | 38 |
38 void CopyOutputRequest::SendTextureResult(gfx::Size size, | 39 void CopyOutputRequest::SendTextureResult(gfx::Size size, |
39 scoped_ptr<TextureMailbox> texture) { | 40 scoped_ptr<TextureMailbox> texture) { |
40 DCHECK(texture->IsTexture()); | 41 DCHECK(texture->IsTexture()); |
41 SendResult(CopyOutputResult::CreateTextureResult(size, | 42 SendResult(CopyOutputResult::CreateTextureResult(size, |
42 texture.Pass()).Pass()); | 43 texture.Pass()).Pass()); |
43 } | 44 } |
44 | 45 |
45 } // namespace cc | 46 } // namespace cc |
OLD | NEW |