Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: gpu/command_buffer/service/in_process_command_buffer.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/message_loop/message_loop_proxy.h"
18 #include "base/sequence_checker.h" 17 #include "base/sequence_checker.h"
19 #include "base/synchronization/condition_variable.h" 18 #include "base/synchronization/condition_variable.h"
20 #include "base/threading/thread.h" 19 #include "base/threading/thread.h"
21 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 20 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
22 #include "gpu/command_buffer/common/value_state.h" 21 #include "gpu/command_buffer/common/value_state.h"
23 #include "gpu/command_buffer/service/command_buffer_service.h" 22 #include "gpu/command_buffer/service/command_buffer_service.h"
24 #include "gpu/command_buffer/service/context_group.h" 23 #include "gpu/command_buffer/service/context_group.h"
25 #include "gpu/command_buffer/service/gl_context_virtual.h" 24 #include "gpu/command_buffer/service/gl_context_virtual.h"
26 #include "gpu/command_buffer/service/gpu_scheduler.h" 25 #include "gpu/command_buffer/service/gpu_scheduler.h"
27 #include "gpu/command_buffer/service/gpu_switches.h" 26 #include "gpu/command_buffer/service/gpu_switches.h"
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 return last_state_.error; 948 return last_state_.error;
950 } 949 }
951 950
952 bool InProcessCommandBuffer::Initialize() { 951 bool InProcessCommandBuffer::Initialize() {
953 NOTREACHED(); 952 NOTREACHED();
954 return false; 953 return false;
955 } 954 }
956 955
957 namespace { 956 namespace {
958 957
959 void PostCallback(const scoped_refptr<base::MessageLoopProxy>& loop, 958 void PostCallback(
960 const base::Closure& callback) { 959 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
961 // The loop.get() check is to support using InProcessCommandBuffer on a thread 960 const base::Closure& callback) {
962 // without a message loop. 961 // The task_runner.get() check is to support using InProcessCommandBuffer on a
963 if (loop.get() && !loop->BelongsToCurrentThread()) { 962 // thread without a message loop.
964 loop->PostTask(FROM_HERE, callback); 963 if (task_runner.get() && !task_runner->BelongsToCurrentThread()) {
964 task_runner->PostTask(FROM_HERE, callback);
965 } else { 965 } else {
966 callback.Run(); 966 callback.Run();
967 } 967 }
968 } 968 }
969 969
970 void RunOnTargetThread(scoped_ptr<base::Closure> callback) { 970 void RunOnTargetThread(scoped_ptr<base::Closure> callback) {
971 DCHECK(callback.get()); 971 DCHECK(callback.get());
972 callback->Run(); 972 callback->Run();
973 } 973 }
974 974
975 } // anonymous namespace 975 } // anonymous namespace
976 976
977 base::Closure InProcessCommandBuffer::WrapCallback( 977 base::Closure InProcessCommandBuffer::WrapCallback(
978 const base::Closure& callback) { 978 const base::Closure& callback) {
979 // Make sure the callback gets deleted on the target thread by passing 979 // Make sure the callback gets deleted on the target thread by passing
980 // ownership. 980 // ownership.
981 scoped_ptr<base::Closure> scoped_callback(new base::Closure(callback)); 981 scoped_ptr<base::Closure> scoped_callback(new base::Closure(callback));
982 base::Closure callback_on_client_thread = 982 base::Closure callback_on_client_thread =
983 base::Bind(&RunOnTargetThread, base::Passed(&scoped_callback)); 983 base::Bind(&RunOnTargetThread, base::Passed(&scoped_callback));
984 base::Closure wrapped_callback = 984 base::Closure wrapped_callback =
985 base::Bind(&PostCallback, base::MessageLoopProxy::current(), 985 base::Bind(&PostCallback, base::MessageLoop::current()->task_runner(),
986 callback_on_client_thread); 986 callback_on_client_thread);
987 return wrapped_callback; 987 return wrapped_callback;
988 } 988 }
989 989
990 #if defined(OS_ANDROID) 990 #if defined(OS_ANDROID)
991 scoped_refptr<gfx::SurfaceTexture> 991 scoped_refptr<gfx::SurfaceTexture>
992 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { 992 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) {
993 DCHECK(stream_texture_manager_); 993 DCHECK(stream_texture_manager_);
994 return stream_texture_manager_->GetSurfaceTexture(stream_id); 994 return stream_texture_manager_->GetSurfaceTexture(stream_id);
995 } 995 }
996 #endif 996 #endif
997 997
998 } // namespace gpu 998 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698