| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 using WebKit::WebFrame; | 94 using WebKit::WebFrame; |
| 95 using WebKit::WebNetworkStateNotifier; | 95 using WebKit::WebNetworkStateNotifier; |
| 96 using WebKit::WebRuntimeFeatures; | 96 using WebKit::WebRuntimeFeatures; |
| 97 using WebKit::WebScriptController; | 97 using WebKit::WebScriptController; |
| 98 using WebKit::WebString; | 98 using WebKit::WebString; |
| 99 using WebKit::WebStorageEventDispatcher; | 99 using WebKit::WebStorageEventDispatcher; |
| 100 using WebKit::WebView; | 100 using WebKit::WebView; |
| 101 using content::RenderProcessObserver; | 101 using content::RenderProcessObserver; |
| 102 | 102 |
| 103 namespace { | 103 namespace { |
| 104 static const int64 kInitialIdleHandlerDelayMs = 1000; | 104 |
| 105 static const int64 kShortIdleHandlerDelayMs = 1000; | 105 const int64 kInitialIdleHandlerDelayMs = 1000; |
| 106 static const int64 kLongIdleHandlerDelayMs = 30*1000; | 106 const int64 kShortIdleHandlerDelayMs = 1000; |
| 107 static const int kIdleCPUUsageThresholdInPercents = 3; | 107 const int64 kLongIdleHandlerDelayMs = 30*1000; |
| 108 const int kIdleCPUUsageThresholdInPercents = 3; |
| 108 | 109 |
| 109 // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access | 110 // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access |
| 110 // incorrectly from the wrong thread. | 111 // incorrectly from the wrong thread. |
| 111 static base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> > | 112 base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> > |
| 112 lazy_tls = LAZY_INSTANCE_INITIALIZER; | 113 lazy_tls = LAZY_INSTANCE_INITIALIZER; |
| 113 | 114 |
| 114 class RenderViewZoomer : public content::RenderViewVisitor { | 115 class RenderViewZoomer : public content::RenderViewVisitor { |
| 115 public: | 116 public: |
| 116 RenderViewZoomer(const GURL& url, double zoom_level) | 117 RenderViewZoomer(const GURL& url, double zoom_level) |
| 117 : zoom_level_(zoom_level) { | 118 : zoom_level_(zoom_level) { |
| 118 host_ = net::GetHostOrSpecFromURL(url); | 119 host_ = net::GetHostOrSpecFromURL(url); |
| 119 } | 120 } |
| 120 | 121 |
| 121 virtual bool Visit(content::RenderView* render_view) { | 122 virtual bool Visit(content::RenderView* render_view) { |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 | 851 |
| 851 scoped_refptr<base::MessageLoopProxy> | 852 scoped_refptr<base::MessageLoopProxy> |
| 852 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 853 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
| 853 DCHECK(message_loop() == MessageLoop::current()); | 854 DCHECK(message_loop() == MessageLoop::current()); |
| 854 if (!file_thread_.get()) { | 855 if (!file_thread_.get()) { |
| 855 file_thread_.reset(new base::Thread("Renderer::FILE")); | 856 file_thread_.reset(new base::Thread("Renderer::FILE")); |
| 856 file_thread_->Start(); | 857 file_thread_->Start(); |
| 857 } | 858 } |
| 858 return file_thread_->message_loop_proxy(); | 859 return file_thread_->message_loop_proxy(); |
| 859 } | 860 } |
| OLD | NEW |