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 "base/base_switches.h" | 5 #include "base/base_switches.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/debug/debugger.h" | 7 #include "base/debug/debugger.h" |
8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/hi_res_timer_manager.h" | 10 #include "base/hi_res_timer_manager.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "base/threading/platform_thread.h" | 22 #include "base/threading/platform_thread.h" |
23 #include "base/time.h" | 23 #include "base/time.h" |
24 #include "content/common/pepper_plugin_registry.h" | 24 #include "content/common/pepper_plugin_registry.h" |
25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
26 #include "content/public/common/main_function_params.h" | 26 #include "content/public/common/main_function_params.h" |
27 #include "content/public/renderer/content_renderer_client.h" | 27 #include "content/public/renderer/content_renderer_client.h" |
28 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" | 28 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" |
29 #include "content/renderer/render_process_impl.h" | 29 #include "content/renderer/render_process_impl.h" |
30 #include "content/renderer/render_thread_impl.h" | 30 #include "content/renderer/render_thread_impl.h" |
31 #include "content/renderer/renderer_main_platform_delegate.h" | 31 #include "content/renderer/renderer_main_platform_delegate.h" |
| 32 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" |
32 #include "ui/base/ui_base_switches.h" | 33 #include "ui/base/ui_base_switches.h" |
33 #include "webkit/plugins/ppapi/ppapi_interface_factory.h" | 34 #include "webkit/plugins/ppapi/ppapi_interface_factory.h" |
34 | 35 |
35 #if defined(OS_MACOSX) | 36 #if defined(OS_MACOSX) |
36 #include <Carbon/Carbon.h> | 37 #include <Carbon/Carbon.h> |
37 #include <signal.h> | 38 #include <signal.h> |
38 #include <unistd.h> | 39 #include <unistd.h> |
39 | 40 |
40 #include "base/mac/mac_util.h" | 41 #include "base/mac/mac_util.h" |
41 #include "base/mac/scoped_nsautorelease_pool.h" | 42 #include "base/mac/scoped_nsautorelease_pool.h" |
42 #include "third_party/mach_override/mach_override.h" | 43 #include "third_party/mach_override/mach_override.h" |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
44 #endif // OS_MACOSX | 45 #endif // OS_MACOSX |
45 | 46 |
| 47 using WebKit::Platform; |
| 48 |
46 namespace content { | 49 namespace content { |
47 | 50 |
48 namespace { | 51 namespace { |
49 | 52 |
50 #if defined(OS_MACOSX) | 53 #if defined(OS_MACOSX) |
51 | 54 |
52 CFArrayRef ChromeTISCreateInputSourceList( | 55 CFArrayRef ChromeTISCreateInputSourceList( |
53 CFDictionaryRef properties, | 56 CFDictionaryRef properties, |
54 Boolean includeAllInstalled) { | 57 Boolean includeAllInstalled) { |
55 CFTypeRef values[] = { CFSTR("") }; | 58 CFTypeRef values[] = { CFSTR("") }; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // This is a simplified version of the browser Jankometer, which measures | 105 // This is a simplified version of the browser Jankometer, which measures |
103 // the processing time of tasks on the render thread. | 106 // the processing time of tasks on the render thread. |
104 class RendererMessageLoopObserver : public MessageLoop::TaskObserver { | 107 class RendererMessageLoopObserver : public MessageLoop::TaskObserver { |
105 public: | 108 public: |
106 RendererMessageLoopObserver() | 109 RendererMessageLoopObserver() |
107 : process_times_(base::Histogram::FactoryGet( | 110 : process_times_(base::Histogram::FactoryGet( |
108 "Chrome.ProcMsgL RenderThread", | 111 "Chrome.ProcMsgL RenderThread", |
109 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag)) {} | 112 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag)) {} |
110 virtual ~RendererMessageLoopObserver() {} | 113 virtual ~RendererMessageLoopObserver() {} |
111 | 114 |
112 virtual void WillProcessTask(base::TimeTicks time_posted) { | 115 virtual void WillProcessTask(base::TimeTicks time_posted) OVERRIDE { |
113 begin_process_message_ = base::TimeTicks::Now(); | 116 begin_process_message_ = base::TimeTicks::Now(); |
114 } | 117 } |
115 | 118 |
116 virtual void DidProcessTask(base::TimeTicks time_posted) { | 119 virtual void DidProcessTask(base::TimeTicks time_posted) OVERRIDE { |
117 if (!begin_process_message_.is_null()) | 120 if (!begin_process_message_.is_null()) |
118 process_times_->AddTime(base::TimeTicks::Now() - begin_process_message_); | 121 process_times_->AddTime(base::TimeTicks::Now() - begin_process_message_); |
| 122 if (Platform::current()) { |
| 123 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 124 render_thread->histogram_customizer()->memory_renderer_used()->Add( |
| 125 Platform::current()->memoryUsageMB() * 1024); |
| 126 } |
119 } | 127 } |
120 | 128 |
121 private: | 129 private: |
122 base::TimeTicks begin_process_message_; | 130 base::TimeTicks begin_process_message_; |
123 base::Histogram* const process_times_; | 131 base::Histogram* const process_times_; |
124 DISALLOW_COPY_AND_ASSIGN(RendererMessageLoopObserver); | 132 DISALLOW_COPY_AND_ASSIGN(RendererMessageLoopObserver); |
125 }; | 133 }; |
126 | 134 |
127 // mainline routine for running as the Renderer process | 135 // mainline routine for running as the Renderer process |
128 int RendererMain(const MainFunctionParams& parameters) { | 136 int RendererMain(const MainFunctionParams& parameters) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 MessageLoop::current()->Run(); | 249 MessageLoop::current()->Run(); |
242 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 250 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
243 } | 251 } |
244 } | 252 } |
245 platform.PlatformUninitialize(); | 253 platform.PlatformUninitialize(); |
246 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 254 TRACE_EVENT_END_ETW("RendererMain", 0, ""); |
247 return 0; | 255 return 0; |
248 } | 256 } |
249 | 257 |
250 } // namespace content | 258 } // namespace content |
OLD | NEW |