Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Side by Side Diff: content/browser/browser_main_loop.h

Issue 19957002: Run the later parts of startup as UI thread tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run the later parts of startup as UI thread tasks - fix component build Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ 5 #ifndef CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_
6 #define CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ 6 #define CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
10 #include "content/browser/browser_process_sub_thread.h" 11 #include "content/browser/browser_process_sub_thread.h"
12 #include "content/public/browser/browser_main_runner.h"
11 13
12 class CommandLine; 14 class CommandLine;
13 15
14 namespace base { 16 namespace base {
15 class HighResolutionTimerManager; 17 class HighResolutionTimerManager;
16 class MessageLoop; 18 class MessageLoop;
17 class PowerMonitor; 19 class PowerMonitor;
18 class SystemMonitor; 20 class SystemMonitor;
19 namespace debug { 21 namespace debug {
20 class TraceMemoryController; 22 class TraceMemoryController;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 60
59 explicit BrowserMainLoop(const MainFunctionParams& parameters); 61 explicit BrowserMainLoop(const MainFunctionParams& parameters);
60 virtual ~BrowserMainLoop(); 62 virtual ~BrowserMainLoop();
61 63
62 void Init(); 64 void Init();
63 65
64 void EarlyInitialization(); 66 void EarlyInitialization();
65 void InitializeToolkit(); 67 void InitializeToolkit();
66 void MainMessageLoopStart(); 68 void MainMessageLoopStart();
67 69
68 // Create all secondary threads. 70 // Create the tasks we need to complete startup.
69 void CreateThreads(); 71 void CreateStartupTasks();
70 72
71 // Perform the default message loop run logic. 73 // Perform the default message loop run logic.
72 void RunMainMessageLoopParts(); 74 void RunMainMessageLoopParts();
73 75
74 // Performs the shutdown sequence, starting with PostMainMessageLoopRun 76 // Performs the shutdown sequence, starting with PostMainMessageLoopRun
75 // through stopping threads to PostDestroyThreads. 77 // through stopping threads to PostDestroyThreads.
76 void ShutdownThreadsAndCleanUp(); 78 void ShutdownThreadsAndCleanUp();
77 79
78 int GetResultCode() const { return result_code_; } 80 int GetResultCode() const { return result_code_; }
79 81
80 media::AudioManager* audio_manager() const { return audio_manager_.get(); } 82 media::AudioManager* audio_manager() const { return audio_manager_.get(); }
81 AudioMirroringManager* audio_mirroring_manager() const { 83 AudioMirroringManager* audio_mirroring_manager() const {
82 return audio_mirroring_manager_.get(); 84 return audio_mirroring_manager_.get();
83 } 85 }
84 MediaStreamManager* media_stream_manager() const { 86 MediaStreamManager* media_stream_manager() const {
85 return media_stream_manager_.get(); 87 return media_stream_manager_.get();
86 } 88 }
87 media::MIDIManager* midi_manager() const { return midi_manager_.get(); } 89 media::MIDIManager* midi_manager() const { return midi_manager_.get(); }
88 base::Thread* indexed_db_thread() const { return indexed_db_thread_.get(); } 90 base::Thread* indexed_db_thread() const { return indexed_db_thread_.get(); }
89 91
90 private: 92 private:
91 class MemoryObserver; 93 class MemoryObserver;
92 // For ShutdownThreadsAndCleanUp. 94 // For ShutdownThreadsAndCleanUp.
93 friend class BrowserShutdownImpl; 95 friend class BrowserShutdownImpl;
94 96
95 void InitializeMainThread(); 97 void InitializeMainThread();
96 98
99 // Called just before creating the threads
100 int PreCreateThreads();
101
102 // Create all secondary threads.
103 int CreateThreads();
104
97 // Called right after the browser threads have been started. 105 // Called right after the browser threads have been started.
98 void BrowserThreadsStarted(); 106 int BrowserThreadsStarted();
107
108 int PreMainMessageLoopRun();
99 109
100 void MainMessageLoopRun(); 110 void MainMessageLoopRun();
101 111
102 // Members initialized on construction --------------------------------------- 112 // Members initialized on construction ---------------------------------------
103 const MainFunctionParams& parameters_; 113 const MainFunctionParams& parameters_;
104 const CommandLine& parsed_command_line_; 114 const CommandLine& parsed_command_line_;
105 int result_code_; 115 int result_code_;
106 116
107 // Members initialized in |MainMessageLoopStart()| --------------------------- 117 // Members initialized in |MainMessageLoopStart()| ---------------------------
108 scoped_ptr<base::MessageLoop> main_message_loop_; 118 scoped_ptr<base::MessageLoop> main_message_loop_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 scoped_ptr<base::Thread> indexed_db_thread_; 156 scoped_ptr<base::Thread> indexed_db_thread_;
147 scoped_ptr<MemoryObserver> memory_observer_; 157 scoped_ptr<MemoryObserver> memory_observer_;
148 scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_; 158 scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_;
149 159
150 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); 160 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop);
151 }; 161 };
152 162
153 } // namespace content 163 } // namespace content
154 164
155 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ 165 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698