OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
887 scoped_refptr<base::MessageLoopProxy> RenderThreadImpl::GetIOLoopProxy() { | 887 scoped_refptr<base::MessageLoopProxy> RenderThreadImpl::GetIOLoopProxy() { |
888 return ChildProcess::current()->io_message_loop_proxy(); | 888 return ChildProcess::current()->io_message_loop_proxy(); |
889 } | 889 } |
890 | 890 |
891 base::WaitableEvent* RenderThreadImpl::GetShutDownEvent() { | 891 base::WaitableEvent* RenderThreadImpl::GetShutDownEvent() { |
892 return ChildProcess::current()->GetShutDownEvent(); | 892 return ChildProcess::current()->GetShutDownEvent(); |
893 } | 893 } |
894 | 894 |
895 scoped_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory( | 895 scoped_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory( |
896 uint32 size) { | 896 uint32 size) { |
897 #if defined(OS_WIN) | |
898 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory); | |
899 if (!shared_memory->CreateAnonymous(size)) | |
jamesr
2012/12/06 22:31:12
content/renderer/pepper/pepper_plugin_delegate_imp
| |
900 return scoped_ptr<base::SharedMemory>(); | |
901 | |
902 return scoped_ptr<base::SharedMemory>(shared_memory.release()); | |
903 #else | |
897 base::SharedMemoryHandle handle; | 904 base::SharedMemoryHandle handle; |
898 bool success; | 905 bool success; |
899 IPC::Message* message = | 906 IPC::Message* message = |
900 new ChildProcessHostMsg_SyncAllocateSharedMemory(size, &handle); | 907 new ChildProcessHostMsg_SyncAllocateSharedMemory(size, &handle); |
901 | 908 |
902 // Allow calling this from the compositor thread. | 909 // Allow calling this from the compositor thread. |
903 if (MessageLoop::current() == message_loop()) | 910 if (MessageLoop::current() == message_loop()) |
904 success = ChildThread::Send(message); | 911 success = ChildThread::Send(message); |
905 else | 912 else |
906 success = sync_message_filter()->Send(message); | 913 success = sync_message_filter()->Send(message); |
907 | 914 |
908 if (!success) | 915 if (!success) |
909 return scoped_ptr<base::SharedMemory>(); | 916 return scoped_ptr<base::SharedMemory>(); |
910 | 917 |
911 if (!base::SharedMemory::IsHandleValid(handle)) | 918 if (!base::SharedMemory::IsHandleValid(handle)) |
912 return scoped_ptr<base::SharedMemory>(); | 919 return scoped_ptr<base::SharedMemory>(); |
913 return scoped_ptr<base::SharedMemory>(new base::SharedMemory(handle, false)); | 920 return scoped_ptr<base::SharedMemory>(new base::SharedMemory(handle, false)); |
921 #endif // defined(OS_WIN) | |
914 } | 922 } |
915 | 923 |
916 int32 RenderThreadImpl::CreateViewCommandBuffer( | 924 int32 RenderThreadImpl::CreateViewCommandBuffer( |
917 int32 surface_id, const GPUCreateCommandBufferConfig& init_params) { | 925 int32 surface_id, const GPUCreateCommandBufferConfig& init_params) { |
918 TRACE_EVENT1("gpu", | 926 TRACE_EVENT1("gpu", |
919 "RenderThreadImpl::CreateViewCommandBuffer", | 927 "RenderThreadImpl::CreateViewCommandBuffer", |
920 "surface_id", | 928 "surface_id", |
921 surface_id); | 929 surface_id); |
922 | 930 |
923 int32 route_id = MSG_ROUTING_NONE; | 931 int32 route_id = MSG_ROUTING_NONE; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1108 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 1116 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
1109 DCHECK(message_loop() == MessageLoop::current()); | 1117 DCHECK(message_loop() == MessageLoop::current()); |
1110 if (!file_thread_.get()) { | 1118 if (!file_thread_.get()) { |
1111 file_thread_.reset(new base::Thread("Renderer::FILE")); | 1119 file_thread_.reset(new base::Thread("Renderer::FILE")); |
1112 file_thread_->Start(); | 1120 file_thread_->Start(); |
1113 } | 1121 } |
1114 return file_thread_->message_loop_proxy(); | 1122 return file_thread_->message_loop_proxy(); |
1115 } | 1123 } |
1116 | 1124 |
1117 } // namespace content | 1125 } // namespace content |
OLD | NEW |