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/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/pending_task.h" |
15 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
16 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
17 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
18 #include "content/browser/browser_thread_impl.h" | 19 #include "content/browser/browser_thread_impl.h" |
19 #include "content/browser/download/save_file_manager.h" | 20 #include "content/browser/download/save_file_manager.h" |
20 #include "content/browser/gamepad/gamepad_service.h" | 21 #include "content/browser/gamepad/gamepad_service.h" |
21 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 22 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
22 #include "content/browser/gpu/gpu_data_manager_impl.h" | 23 #include "content/browser/gpu/gpu_data_manager_impl.h" |
23 #include "content/browser/gpu/gpu_process_host.h" | 24 #include "content/browser/gpu/gpu_process_host.h" |
24 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 25 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 void ImmediateShutdownAndExitProcess() { | 230 void ImmediateShutdownAndExitProcess() { |
230 BrowserShutdownImpl::ImmediateShutdownAndExitProcess(); | 231 BrowserShutdownImpl::ImmediateShutdownAndExitProcess(); |
231 } | 232 } |
232 | 233 |
233 // For measuring memory usage after each task. Behind a command line flag. | 234 // For measuring memory usage after each task. Behind a command line flag. |
234 class BrowserMainLoop::MemoryObserver : public MessageLoop::TaskObserver { | 235 class BrowserMainLoop::MemoryObserver : public MessageLoop::TaskObserver { |
235 public: | 236 public: |
236 MemoryObserver() {} | 237 MemoryObserver() {} |
237 virtual ~MemoryObserver() {} | 238 virtual ~MemoryObserver() {} |
238 | 239 |
239 virtual void WillProcessTask(base::TimeTicks time_posted) OVERRIDE {} | 240 virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE { |
| 241 } |
240 | 242 |
241 virtual void DidProcessTask(base::TimeTicks time_posted) OVERRIDE { | 243 virtual void DidProcessTask(const base::PendingTask& pending_task) OVERRIDE { |
242 #if !defined(OS_IOS) | 244 #if !defined(OS_IOS) |
243 HISTOGRAM_MEMORY_KB("Memory.BrowserUsed", webkit_glue::MemoryUsageKB()); | 245 HISTOGRAM_MEMORY_KB("Memory.BrowserUsed", webkit_glue::MemoryUsageKB()); |
244 #endif | 246 #endif |
245 } | 247 } |
246 private: | 248 private: |
247 DISALLOW_COPY_AND_ASSIGN(MemoryObserver); | 249 DISALLOW_COPY_AND_ASSIGN(MemoryObserver); |
248 }; | 250 }; |
249 | 251 |
250 | 252 |
251 // static | 253 // static |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 805 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
804 if (parameters_.ui_task) | 806 if (parameters_.ui_task) |
805 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 807 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
806 | 808 |
807 base::RunLoop run_loop; | 809 base::RunLoop run_loop; |
808 run_loop.Run(); | 810 run_loop.Run(); |
809 #endif | 811 #endif |
810 } | 812 } |
811 | 813 |
812 } // namespace content | 814 } // namespace content |
OLD | NEW |