Chromium Code Reviews| 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" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 } | 28 } |
| 29 | 29 |
| 30 CopyOutputRequest::CopyOutputRequest() {} | 30 CopyOutputRequest::CopyOutputRequest() {} |
| 31 | 31 |
| 32 CopyOutputRequest::CopyOutputRequest( | 32 CopyOutputRequest::CopyOutputRequest( |
| 33 bool force_bitmap_result, | 33 bool force_bitmap_result, |
| 34 const CopyOutputRequestCallback& result_callback) | 34 const CopyOutputRequestCallback& result_callback) |
| 35 : force_bitmap_result_(force_bitmap_result), | 35 : force_bitmap_result_(force_bitmap_result), |
| 36 has_area_(false), | 36 has_area_(false), |
| 37 has_texture_mailbox_(false), | 37 has_texture_mailbox_(false), |
| 38 result_callback_(result_callback) {} | 38 result_callback_(result_callback) { |
| 39 DCHECK(!result_callback_.is_null()); | |
| 40 TRACE_EVENT_ASYNC_BEGIN0("cc", "CopyOutputRequest", this); | |
| 41 } | |
| 39 | 42 |
| 40 CopyOutputRequest::~CopyOutputRequest() { | 43 CopyOutputRequest::~CopyOutputRequest() { |
| 41 if (!result_callback_.is_null()) | 44 if (!result_callback_.is_null()) { |
| 42 SendResult(CopyOutputResult::CreateEmptyResult().Pass()); | 45 SendResult(CopyOutputResult::CreateEmptyResult().Pass()); |
| 46 TRACE_EVENT_ASYNC_END0("cc", "CopyOutputRequest", this); | |
|
jdduke (slow)
2014/04/25 17:36:00
Oops, forgot to delete this line.
| |
| 47 } | |
| 43 } | 48 } |
| 44 | 49 |
| 45 void CopyOutputRequest::SendResult(scoped_ptr<CopyOutputResult> result) { | 50 void CopyOutputRequest::SendResult(scoped_ptr<CopyOutputResult> result) { |
| 46 base::ResetAndReturn(&result_callback_).Run(result.Pass()); | 51 base::ResetAndReturn(&result_callback_).Run(result.Pass()); |
| 52 TRACE_EVENT_ASYNC_END0("cc", "CopyOutputRequest", this); | |
| 47 } | 53 } |
| 48 | 54 |
| 49 void CopyOutputRequest::SendEmptyResult() { | 55 void CopyOutputRequest::SendEmptyResult() { |
| 50 SendResult(CopyOutputResult::CreateEmptyResult().Pass()); | 56 SendResult(CopyOutputResult::CreateEmptyResult().Pass()); |
| 51 } | 57 } |
| 52 | 58 |
| 53 void CopyOutputRequest::SendBitmapResult(scoped_ptr<SkBitmap> bitmap) { | 59 void CopyOutputRequest::SendBitmapResult(scoped_ptr<SkBitmap> bitmap) { |
| 54 SendResult(CopyOutputResult::CreateBitmapResult(bitmap.Pass()).Pass()); | 60 SendResult(CopyOutputResult::CreateBitmapResult(bitmap.Pass()).Pass()); |
| 55 } | 61 } |
| 56 | 62 |
| 57 void CopyOutputRequest::SendTextureResult( | 63 void CopyOutputRequest::SendTextureResult( |
| 58 const gfx::Size& size, | 64 const gfx::Size& size, |
| 59 const TextureMailbox& texture_mailbox, | 65 const TextureMailbox& texture_mailbox, |
| 60 scoped_ptr<SingleReleaseCallback> release_callback) { | 66 scoped_ptr<SingleReleaseCallback> release_callback) { |
| 61 DCHECK(texture_mailbox.IsTexture()); | 67 DCHECK(texture_mailbox.IsTexture()); |
| 62 SendResult(CopyOutputResult::CreateTextureResult( | 68 SendResult(CopyOutputResult::CreateTextureResult( |
| 63 size, texture_mailbox, release_callback.Pass())); | 69 size, texture_mailbox, release_callback.Pass())); |
| 64 } | 70 } |
| 65 | 71 |
| 66 void CopyOutputRequest::SetTextureMailbox( | 72 void CopyOutputRequest::SetTextureMailbox( |
| 67 const TextureMailbox& texture_mailbox) { | 73 const TextureMailbox& texture_mailbox) { |
| 68 DCHECK(!force_bitmap_result_); | 74 DCHECK(!force_bitmap_result_); |
| 69 DCHECK(texture_mailbox.IsTexture()); | 75 DCHECK(texture_mailbox.IsTexture()); |
| 70 has_texture_mailbox_ = true; | 76 has_texture_mailbox_ = true; |
| 71 texture_mailbox_ = texture_mailbox; | 77 texture_mailbox_ = texture_mailbox; |
| 72 } | 78 } |
| 73 | 79 |
| 74 } // namespace cc | 80 } // namespace cc |
| OLD | NEW |