| 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/test/test_context_support.h" | 5 #include "cc/test/test_context_support.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 set_visible_callback_ = set_visible_callback; | 56 set_visible_callback_ = set_visible_callback; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void TestContextSupport::Swap() { | 59 void TestContextSupport::Swap() { |
| 60 last_swap_type_ = SWAP; | 60 last_swap_type_ = SWAP; |
| 61 base::MessageLoop::current()->PostTask( | 61 base::MessageLoop::current()->PostTask( |
| 62 FROM_HERE, base::Bind(&TestContextSupport::OnSwapBuffersComplete, | 62 FROM_HERE, base::Bind(&TestContextSupport::OnSwapBuffersComplete, |
| 63 weak_ptr_factory_.GetWeakPtr())); | 63 weak_ptr_factory_.GetWeakPtr())); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void TestContextSupport::PartialSwapBuffers(gfx::Rect sub_buffer) { | 66 void TestContextSupport::PartialSwapBuffers(const gfx::Rect& sub_buffer) { |
| 67 last_swap_type_ = PARTIAL_SWAP; | 67 last_swap_type_ = PARTIAL_SWAP; |
| 68 last_partial_swap_rect_ = sub_buffer; | 68 last_partial_swap_rect_ = sub_buffer; |
| 69 base::MessageLoop::current()->PostTask( | 69 base::MessageLoop::current()->PostTask( |
| 70 FROM_HERE, base::Bind(&TestContextSupport::OnSwapBuffersComplete, | 70 FROM_HERE, base::Bind(&TestContextSupport::OnSwapBuffersComplete, |
| 71 weak_ptr_factory_.GetWeakPtr())); | 71 weak_ptr_factory_.GetWeakPtr())); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void TestContextSupport::SetSwapBuffersCompleteCallback( | 74 void TestContextSupport::SetSwapBuffersCompleteCallback( |
| 75 const base::Closure& callback) { | 75 const base::Closure& callback) { |
| 76 swap_buffers_complete_callback_ = callback; | 76 swap_buffers_complete_callback_ = callback; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void TestContextSupport::OnSwapBuffersComplete() { | 79 void TestContextSupport::OnSwapBuffersComplete() { |
| 80 if (!swap_buffers_complete_callback_.is_null()) | 80 if (!swap_buffers_complete_callback_.is_null()) |
| 81 swap_buffers_complete_callback_.Run(); | 81 swap_buffers_complete_callback_.Run(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace cc | 84 } // namespace cc |
| OLD | NEW |