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 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 NOTREACHED(); | 1127 NOTREACHED(); |
1128 } | 1128 } |
1129 | 1129 |
1130 void RenderThreadImpl::DeleteImage(int32 image_id, int32 sync_point) { | 1130 void RenderThreadImpl::DeleteImage(int32 image_id, int32 sync_point) { |
1131 NOTREACHED(); | 1131 NOTREACHED(); |
1132 } | 1132 } |
1133 | 1133 |
1134 scoped_ptr<gfx::GpuMemoryBuffer> RenderThreadImpl::AllocateGpuMemoryBuffer( | 1134 scoped_ptr<gfx::GpuMemoryBuffer> RenderThreadImpl::AllocateGpuMemoryBuffer( |
1135 size_t width, | 1135 size_t width, |
1136 size_t height, | 1136 size_t height, |
1137 unsigned internalformat) { | 1137 unsigned internalformat, |
| 1138 gfx::GpuMemoryBuffer::Usage usage) { |
1138 DCHECK(allocate_gpu_memory_buffer_thread_checker_.CalledOnValidThread()); | 1139 DCHECK(allocate_gpu_memory_buffer_thread_checker_.CalledOnValidThread()); |
1139 | 1140 |
1140 if (!GpuMemoryBufferImpl::IsFormatValid(internalformat)) | 1141 if (!GpuMemoryBufferImpl::IsFormatValid(internalformat)) |
1141 return scoped_ptr<gfx::GpuMemoryBuffer>(); | 1142 return scoped_ptr<gfx::GpuMemoryBuffer>(); |
1142 | 1143 |
1143 gfx::GpuMemoryBufferHandle handle; | 1144 gfx::GpuMemoryBufferHandle handle; |
1144 bool success; | 1145 bool success; |
1145 IPC::Message* message = | 1146 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( |
1146 new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer(width, | 1147 width, height, internalformat, usage, &handle); |
1147 height, | |
1148 internalformat, | |
1149 &handle); | |
1150 | 1148 |
1151 // Allow calling this from the compositor thread. | 1149 // Allow calling this from the compositor thread. |
1152 if (base::MessageLoop::current() == message_loop()) | 1150 if (base::MessageLoop::current() == message_loop()) |
1153 success = ChildThread::Send(message); | 1151 success = ChildThread::Send(message); |
1154 else | 1152 else |
1155 success = sync_message_filter()->Send(message); | 1153 success = sync_message_filter()->Send(message); |
1156 | 1154 |
1157 if (!success) | 1155 if (!success) |
1158 return scoped_ptr<gfx::GpuMemoryBuffer>(); | 1156 return scoped_ptr<gfx::GpuMemoryBuffer>(); |
1159 | 1157 |
1160 return GpuMemoryBufferImpl::Create( | 1158 return GpuMemoryBufferImpl::Create( |
1161 handle, | 1159 handle, gfx::Size(width, height), internalformat, usage) |
1162 gfx::Size(width, height), | 1160 .PassAs<gfx::GpuMemoryBuffer>(); |
1163 internalformat).PassAs<gfx::GpuMemoryBuffer>(); | |
1164 } | 1161 } |
1165 | 1162 |
1166 void RenderThreadImpl::AcceptConnection( | 1163 void RenderThreadImpl::AcceptConnection( |
1167 const mojo::String& service_name, | 1164 const mojo::String& service_name, |
1168 mojo::ScopedMessagePipeHandle message_pipe) { | 1165 mojo::ScopedMessagePipeHandle message_pipe) { |
1169 // TODO(darin): Invent some kind of registration system to use here. | 1166 // TODO(darin): Invent some kind of registration system to use here. |
1170 if (service_name.To<base::StringPiece>() == kRendererService_WebUISetup) { | 1167 if (service_name.To<base::StringPiece>() == kRendererService_WebUISetup) { |
1171 WebUISetupImpl::Bind(message_pipe.Pass()); | 1168 WebUISetupImpl::Bind(message_pipe.Pass()); |
1172 } else { | 1169 } else { |
1173 NOTREACHED() << "Unknown service name"; | 1170 NOTREACHED() << "Unknown service name"; |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 hidden_widget_count_--; | 1488 hidden_widget_count_--; |
1492 | 1489 |
1493 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1490 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1494 return; | 1491 return; |
1495 } | 1492 } |
1496 | 1493 |
1497 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1494 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1498 } | 1495 } |
1499 | 1496 |
1500 } // namespace content | 1497 } // namespace content |
OLD | NEW |