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 "gpu/command_buffer/service/in_process_command_buffer.h" | 5 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 | 740 |
741 bool InProcessCommandBuffer::Initialize() { | 741 bool InProcessCommandBuffer::Initialize() { |
742 NOTREACHED(); | 742 NOTREACHED(); |
743 return false; | 743 return false; |
744 } | 744 } |
745 | 745 |
746 namespace { | 746 namespace { |
747 | 747 |
748 void PostCallback(const scoped_refptr<base::MessageLoopProxy>& loop, | 748 void PostCallback(const scoped_refptr<base::MessageLoopProxy>& loop, |
749 const base::Closure& callback) { | 749 const base::Closure& callback) { |
750 if (!loop->BelongsToCurrentThread()) { | 750 // The loop.get() check is to support using InProcessCommandBuffer on a thread |
| 751 // without a message loop. |
| 752 if (loop.get() && !loop->BelongsToCurrentThread()) { |
751 loop->PostTask(FROM_HERE, callback); | 753 loop->PostTask(FROM_HERE, callback); |
752 } else { | 754 } else { |
753 callback.Run(); | 755 callback.Run(); |
754 } | 756 } |
755 } | 757 } |
756 | 758 |
757 void RunOnTargetThread(scoped_ptr<base::Closure> callback) { | 759 void RunOnTargetThread(scoped_ptr<base::Closure> callback) { |
758 DCHECK(callback.get()); | 760 DCHECK(callback.get()); |
759 callback->Run(); | 761 callback->Run(); |
760 } | 762 } |
(...skipping 15 matching lines...) Expand all Loading... |
776 | 778 |
777 #if defined(OS_ANDROID) | 779 #if defined(OS_ANDROID) |
778 scoped_refptr<gfx::SurfaceTexture> | 780 scoped_refptr<gfx::SurfaceTexture> |
779 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { | 781 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { |
780 DCHECK(stream_texture_manager_); | 782 DCHECK(stream_texture_manager_); |
781 return stream_texture_manager_->GetSurfaceTexture(stream_id); | 783 return stream_texture_manager_->GetSurfaceTexture(stream_id); |
782 } | 784 } |
783 #endif | 785 #endif |
784 | 786 |
785 } // namespace gpu | 787 } // namespace gpu |
OLD | NEW |