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 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1095 scoped_ptr<gfx::GpuMemoryBuffer> RenderThreadImpl::AllocateGpuMemoryBuffer( | 1095 scoped_ptr<gfx::GpuMemoryBuffer> RenderThreadImpl::AllocateGpuMemoryBuffer( |
1096 size_t width, | 1096 size_t width, |
1097 size_t height, | 1097 size_t height, |
1098 unsigned internalformat) { | 1098 unsigned internalformat) { |
1099 DCHECK(allocate_gpu_memory_buffer_thread_checker_.CalledOnValidThread()); | 1099 DCHECK(allocate_gpu_memory_buffer_thread_checker_.CalledOnValidThread()); |
1100 | 1100 |
1101 if (!GpuMemoryBufferImpl::IsFormatValid(internalformat)) | 1101 if (!GpuMemoryBufferImpl::IsFormatValid(internalformat)) |
1102 return scoped_ptr<gfx::GpuMemoryBuffer>(); | 1102 return scoped_ptr<gfx::GpuMemoryBuffer>(); |
1103 | 1103 |
1104 gfx::GpuMemoryBufferHandle handle; | 1104 gfx::GpuMemoryBufferHandle handle; |
1105 bool success; | |
1106 IPC::Message* message = | |
1107 new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer(width, | |
1108 height, | |
1109 internalformat, | |
1110 &handle); | |
reveman
2014/02/26 08:02:34
Please don't change any of code in this function.
| |
1111 | 1105 |
1112 // Allow calling this from the compositor thread. | 1106 #if defined(OS_ANDROID) |
1113 if (base::MessageLoop::current() == message_loop()) | 1107 bool is_android = true; |
1114 success = ChildThread::Send(message); | 1108 #else |
1115 else | 1109 bool is_android = false; |
1116 success = sync_message_filter()->Send(message); | 1110 #endif |
1117 | 1111 |
1118 if (!success) | 1112 if (!is_android || !CommandLine::ForCurrentProcess()->HasSwitch( |
1119 return scoped_ptr<gfx::GpuMemoryBuffer>(); | 1113 switches::KEnableSurfaceTextureBuffer)) { |
1114 bool success; | |
1115 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( | |
1116 width, height, internalformat, &handle); | |
1117 | |
1118 // Allow calling this from the compositor thread. | |
1119 if (base::MessageLoop::current() == message_loop()) | |
1120 success = ChildThread::Send(message); | |
1121 else | |
1122 success = sync_message_filter()->Send(message); | |
1123 | |
1124 if (!success) | |
1125 return scoped_ptr<gfx::GpuMemoryBuffer>(); | |
1126 } else | |
1127 handle.type = gfx::SURFACE_TEXTURE_BUFFER; | |
1120 | 1128 |
1121 return GpuMemoryBufferImpl::Create( | 1129 return GpuMemoryBufferImpl::Create( |
1122 handle, | 1130 handle, |
1123 gfx::Size(width, height), | 1131 gfx::Size(width, height), |
1124 internalformat).PassAs<gfx::GpuMemoryBuffer>(); | 1132 internalformat).PassAs<gfx::GpuMemoryBuffer>(); |
1125 } | 1133 } |
1126 | 1134 |
1127 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { | 1135 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { |
1128 suspend_webkit_shared_timer_ = false; | 1136 suspend_webkit_shared_timer_ = false; |
1129 } | 1137 } |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1415 hidden_widget_count_--; | 1423 hidden_widget_count_--; |
1416 | 1424 |
1417 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1425 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1418 return; | 1426 return; |
1419 } | 1427 } |
1420 | 1428 |
1421 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1429 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1422 } | 1430 } |
1423 | 1431 |
1424 } // namespace content | 1432 } // namespace content |
OLD | NEW |