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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 } | 178 } |
| 179 | 179 |
| 180 RenderThreadImpl::RenderThreadImpl(const std::string& channel_name) | 180 RenderThreadImpl::RenderThreadImpl(const std::string& channel_name) |
| 181 : ChildThread(channel_name) { | 181 : ChildThread(channel_name) { |
| 182 Init(); | 182 Init(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void RenderThreadImpl::Init() { | 185 void RenderThreadImpl::Init() { |
| 186 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, ""); | 186 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, ""); |
| 187 | 187 |
| 188 v8::V8::SetCounterFunction(base::StatsTable::FindLocation); | |
|
jochen (gone - plz use gerrit)
2012/07/11 15:13:16
V8 counters only try once to lookup themselves up,
| |
| 189 v8::V8::SetCreateHistogramFunction(CreateHistogram); | |
| 190 v8::V8::SetAddHistogramSampleFunction(AddHistogramSample); | |
| 191 | |
| 188 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 192 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 189 // On Mac and Android, the select popups are rendered by the browser. | 193 // On Mac and Android, the select popups are rendered by the browser. |
| 190 WebKit::WebView::setUseExternalPopupMenus(true); | 194 WebKit::WebView::setUseExternalPopupMenus(true); |
| 191 #endif | 195 #endif |
| 192 | 196 |
| 193 lazy_tls.Pointer()->Set(this); | 197 lazy_tls.Pointer()->Set(this); |
| 194 | 198 |
| 195 #if defined(OS_WIN) | 199 #if defined(OS_WIN) |
| 196 // If you are running plugins in this thread you need COM active but in | 200 // If you are running plugins in this thread you need COM active but in |
| 197 // the normal case you don't. | 201 // the normal case you don't. |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 474 return; | 478 return; |
| 475 } | 479 } |
| 476 | 480 |
| 477 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 481 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
| 478 } | 482 } |
| 479 | 483 |
| 480 void RenderThreadImpl::EnsureWebKitInitialized() { | 484 void RenderThreadImpl::EnsureWebKitInitialized() { |
| 481 if (webkit_platform_support_.get()) | 485 if (webkit_platform_support_.get()) |
| 482 return; | 486 return; |
| 483 | 487 |
| 484 v8::V8::SetCounterFunction(base::StatsTable::FindLocation); | |
| 485 v8::V8::SetCreateHistogramFunction(CreateHistogram); | |
| 486 v8::V8::SetAddHistogramSampleFunction(AddHistogramSample); | |
| 487 | |
| 488 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); | 488 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); |
| 489 WebKit::initialize(webkit_platform_support_.get()); | 489 WebKit::initialize(webkit_platform_support_.get()); |
| 490 | 490 |
| 491 bool has_enable = CommandLine::ForCurrentProcess()->HasSwitch( | 491 bool has_enable = CommandLine::ForCurrentProcess()->HasSwitch( |
| 492 switches::kEnableThreadedCompositing); | 492 switches::kEnableThreadedCompositing); |
| 493 bool has_disable = CommandLine::ForCurrentProcess()->HasSwitch( | 493 bool has_disable = CommandLine::ForCurrentProcess()->HasSwitch( |
| 494 switches::kDisableThreadedCompositing); | 494 switches::kDisableThreadedCompositing); |
| 495 // TODO(fsamuel): Guests don't currently support threaded compositing. | 495 // TODO(fsamuel): Guests don't currently support threaded compositing. |
| 496 // This should go away with the new design of the browser plugin. | 496 // This should go away with the new design of the browser plugin. |
| 497 // The new design can be tracked at: http://crbug.com/134492. | 497 // The new design can be tracked at: http://crbug.com/134492. |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1024 | 1024 |
| 1025 scoped_refptr<base::MessageLoopProxy> | 1025 scoped_refptr<base::MessageLoopProxy> |
| 1026 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 1026 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
| 1027 DCHECK(message_loop() == MessageLoop::current()); | 1027 DCHECK(message_loop() == MessageLoop::current()); |
| 1028 if (!file_thread_.get()) { | 1028 if (!file_thread_.get()) { |
| 1029 file_thread_.reset(new base::Thread("Renderer::FILE")); | 1029 file_thread_.reset(new base::Thread("Renderer::FILE")); |
| 1030 file_thread_->Start(); | 1030 file_thread_->Start(); |
| 1031 } | 1031 } |
| 1032 return file_thread_->message_loop_proxy(); | 1032 return file_thread_->message_loop_proxy(); |
| 1033 } | 1033 } |
| OLD | NEW |