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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(swappedout_scheme); | 731 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(swappedout_scheme); |
732 WebSecurityPolicy::registerURLSchemeAsEmptyDocument(swappedout_scheme); | 732 WebSecurityPolicy::registerURLSchemeAsEmptyDocument(swappedout_scheme); |
733 } | 733 } |
734 | 734 |
735 void RenderThreadImpl::RecordUserMetrics(const std::string& action) { | 735 void RenderThreadImpl::RecordUserMetrics(const std::string& action) { |
736 Send(new ViewHostMsg_UserMetricsRecordAction(action)); | 736 Send(new ViewHostMsg_UserMetricsRecordAction(action)); |
737 } | 737 } |
738 | 738 |
739 scoped_ptr<base::SharedMemory> | 739 scoped_ptr<base::SharedMemory> |
740 RenderThreadImpl::HostAllocateSharedMemoryBuffer(uint32 size) { | 740 RenderThreadImpl::HostAllocateSharedMemoryBuffer(uint32 size) { |
741 //if (!size) | |
742 // return scoped_ptr<base::SharedMemory>(); | |
743 | |
744 //#if defined(OS_WIN) | |
745 // scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory); | |
746 // if (!shared_memory->CreateAnonymous(size)) | |
747 // return scoped_ptr<base::SharedMemory>(); | |
748 // | |
749 // return scoped_ptr<base::SharedMemory>(shared_memory.release()); | |
750 //#else | |
751 base::SharedMemoryHandle handle; | 741 base::SharedMemoryHandle handle; |
752 bool success; | 742 bool success; |
753 IPC::Message* message = | 743 IPC::Message* message = |
754 new ChildProcessHostMsg_SyncAllocateSharedMemory(size, &handle); | 744 new ChildProcessHostMsg_SyncAllocateSharedMemory(size, &handle); |
755 | 745 |
756 // Allow calling this from the compositor thread. | 746 // Allow calling this from the compositor thread. |
757 if (MessageLoop::current() == message_loop()) | 747 if (MessageLoop::current() == message_loop()) |
758 success = ChildThread::Send(message); | 748 success = ChildThread::Send(message); |
759 else | 749 else |
760 success = sync_message_filter()->Send(message); | 750 success = sync_message_filter()->Send(message); |
761 | 751 |
762 if (!success) | 752 if (!success) |
763 return scoped_ptr<base::SharedMemory>(); | 753 return scoped_ptr<base::SharedMemory>(); |
764 | 754 |
765 if (!base::SharedMemory::IsHandleValid(handle)) | 755 if (!base::SharedMemory::IsHandleValid(handle)) |
766 return scoped_ptr<base::SharedMemory>(); | 756 return scoped_ptr<base::SharedMemory>(); |
767 | 757 |
768 return scoped_ptr<base::SharedMemory>(new base::SharedMemory(handle, false)); | 758 return scoped_ptr<base::SharedMemory>(new base::SharedMemory(handle, false)); |
769 //#endif // defined(OS_WIN) | |
770 } | 759 } |
771 | 760 |
772 void RenderThreadImpl::RegisterExtension(v8::Extension* extension) { | 761 void RenderThreadImpl::RegisterExtension(v8::Extension* extension) { |
773 WebScriptController::registerExtension(extension); | 762 WebScriptController::registerExtension(extension); |
774 } | 763 } |
775 | 764 |
776 void RenderThreadImpl::ScheduleIdleHandler(int64 initial_delay_ms) { | 765 void RenderThreadImpl::ScheduleIdleHandler(int64 initial_delay_ms) { |
777 idle_notification_delay_in_ms_ = initial_delay_ms; | 766 idle_notification_delay_in_ms_ = initial_delay_ms; |
778 idle_timer_.Stop(); | 767 idle_timer_.Stop(); |
779 idle_timer_.Start(FROM_HERE, | 768 idle_timer_.Start(FROM_HERE, |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 1146 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
1158 DCHECK(message_loop() == MessageLoop::current()); | 1147 DCHECK(message_loop() == MessageLoop::current()); |
1159 if (!file_thread_.get()) { | 1148 if (!file_thread_.get()) { |
1160 file_thread_.reset(new base::Thread("Renderer::FILE")); | 1149 file_thread_.reset(new base::Thread("Renderer::FILE")); |
1161 file_thread_->Start(); | 1150 file_thread_->Start(); |
1162 } | 1151 } |
1163 return file_thread_->message_loop_proxy(); | 1152 return file_thread_->message_loop_proxy(); |
1164 } | 1153 } |
1165 | 1154 |
1166 } // namespace content | 1155 } // namespace content |
OLD | NEW |