Chromium Code Reviews| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 #include "base/memory/scoped_handle.h" | 120 #include "base/memory/scoped_handle.h" |
| 121 #include "content/child/npapi/np_channel_base.h" | 121 #include "content/child/npapi/np_channel_base.h" |
| 122 #endif | 122 #endif |
| 123 | 123 |
| 124 #if defined(OS_POSIX) | 124 #if defined(OS_POSIX) |
| 125 #include "ipc/ipc_channel_posix.h" | 125 #include "ipc/ipc_channel_posix.h" |
| 126 #endif | 126 #endif |
| 127 | 127 |
| 128 #if defined(OS_ANDROID) | 128 #if defined(OS_ANDROID) |
| 129 #include <cpu-features.h> | 129 #include <cpu-features.h> |
| 130 #include "base/android/sys_utils.h" | |
| 130 #include "content/renderer/android/synchronous_compositor_factory.h" | 131 #include "content/renderer/android/synchronous_compositor_factory.h" |
| 131 #endif | 132 #endif |
| 132 | 133 |
| 133 #if defined(ENABLE_PLUGINS) | 134 #if defined(ENABLE_PLUGINS) |
| 134 #include "content/renderer/npapi/plugin_channel_host.h" | 135 #include "content/renderer/npapi/plugin_channel_host.h" |
| 135 #endif | 136 #endif |
| 136 | 137 |
| 137 using base::ThreadRestrictions; | 138 using base::ThreadRestrictions; |
| 138 using WebKit::WebDocument; | 139 using WebKit::WebDocument; |
| 139 using WebKit::WebFrame; | 140 using WebKit::WebFrame; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, ""); | 317 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, ""); |
| 317 | 318 |
| 318 base::debug::TraceLog::GetInstance()->SetThreadSortIndex( | 319 base::debug::TraceLog::GetInstance()->SetThreadSortIndex( |
| 319 base::PlatformThread::CurrentId(), | 320 base::PlatformThread::CurrentId(), |
| 320 kTraceEventRendererMainThreadSortIndex); | 321 kTraceEventRendererMainThreadSortIndex); |
| 321 | 322 |
| 322 v8::V8::SetCounterFunction(base::StatsTable::FindLocation); | 323 v8::V8::SetCounterFunction(base::StatsTable::FindLocation); |
| 323 v8::V8::SetCreateHistogramFunction(CreateHistogram); | 324 v8::V8::SetCreateHistogramFunction(CreateHistogram); |
| 324 v8::V8::SetAddHistogramSampleFunction(AddHistogramSample); | 325 v8::V8::SetAddHistogramSampleFunction(AddHistogramSample); |
| 325 | 326 |
| 327 #if defined(OS_ANDROID) | |
| 328 bool is_memory_constrained = base::android::SysUtils::IsLowEndDevice(); | |
| 329 v8::ResourceConstraints resourceConstraints; | |
| 330 resourceConstraints.set_memory_constrained(&is_memory_constrained); | |
|
jamesr
2013/09/06 00:24:04
can you please show me where this API is provided?
| |
| 331 v8::SetResourceConstraints(&resourceConstraints); | |
| 332 #endif | |
| 333 | |
| 326 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 334 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 327 // On Mac and Android, the select popups are rendered by the browser. | 335 // On Mac and Android, the select popups are rendered by the browser. |
| 328 WebKit::WebView::setUseExternalPopupMenus(true); | 336 WebKit::WebView::setUseExternalPopupMenus(true); |
| 329 #endif | 337 #endif |
| 330 | 338 |
| 331 lazy_tls.Pointer()->Set(this); | 339 lazy_tls.Pointer()->Set(this); |
| 332 | 340 |
| 333 #if defined(OS_WIN) | 341 #if defined(OS_WIN) |
| 334 // If you are running plugins in this thread you need COM active but in | 342 // If you are running plugins in this thread you need COM active but in |
| 335 // the normal case you don't. | 343 // the normal case you don't. |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1307 | 1315 |
| 1308 } | 1316 } |
| 1309 | 1317 |
| 1310 void RenderThreadImpl::SampleGamepads(WebKit::WebGamepads* data) { | 1318 void RenderThreadImpl::SampleGamepads(WebKit::WebGamepads* data) { |
| 1311 if (!gamepad_shared_memory_reader_) | 1319 if (!gamepad_shared_memory_reader_) |
| 1312 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); | 1320 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); |
| 1313 gamepad_shared_memory_reader_->SampleGamepads(*data); | 1321 gamepad_shared_memory_reader_->SampleGamepads(*data); |
| 1314 } | 1322 } |
| 1315 | 1323 |
| 1316 } // namespace content | 1324 } // namespace content |
| OLD | NEW |