Index: content/public/browser/browser_main_parts.h |
diff --git a/content/public/browser/browser_main_parts.h b/content/public/browser/browser_main_parts.h |
index 0bbaa835d3e050582058e4ce4fc8992a420b124b..c9be5b3db7db01d2617b0cd4dbe2dd1c629dfa95 100644 |
--- a/content/public/browser/browser_main_parts.h |
+++ b/content/public/browser/browser_main_parts.h |
@@ -8,9 +8,12 @@ |
#include "base/basictypes.h" |
#include "content/common/content_export.h" |
+#include "content/public/browser/browser_thread.h" |
namespace content { |
+class IOThreadDelegate; |
+ |
// This class contains different "stages" to be executed by |BrowserMain()|, |
// Each stage is represented by a single BrowserMainParts method, called from |
// the corresponding method in |BrowserMainLoop| (e.g., EarlyInitialization()) |
@@ -68,7 +71,24 @@ class CONTENT_EXPORT BrowserMainParts { |
virtual void PostMainMessageLoopStart() = 0; |
- virtual void PreMainMessageLoopRun() = 0; |
+ // Child threads have not been created at this point. |
+ // |
+ // This method may return NULL, or an object implementing |
+ // IOThreadDelegate. If the latter, this object's Init method will |
+ // be called as the first thing that happens on the "IO" |
+ // BrowserThread, and its CleanUp method as the last. |
+ // |
+ // Implementations of BrowserMainParts must ensure that the returned |
+ // object's lifetime extends beyond the call to |
+ // PostStopThread(BrowserThread::IO). |
+ // |
+ // It is currently an error for more than one BrowserMainParts |
+ // implementation to return a delegate. This could be fixed to |
+ // allow multiple delegates if needed. |
+ virtual IOThreadDelegate* PreMainMessageLoopRun() = 0; |
jam
2011/11/17 21:51:21
it seems a little odd that this interface is given
Jói
2011/11/18 23:21:44
I switched to just posting a message to initialize
|
+ |
+ // The various browser threads have been created at this point. |
+ virtual void PreMainMessageLoopRunThreadsCreated() = 0; |
// Returns true if the message loop was run, false otherwise. |
// May set |result_code|, which will be returned by |BrowserMain()|. |
@@ -76,8 +96,20 @@ class CONTENT_EXPORT BrowserMainParts { |
// implementation will be run. |
virtual bool MainMessageLoopRun(int* result_code) = 0; |
+ // This happens after the main message loop has stopped, but before |
+ // threads are stopped. |
virtual void PostMainMessageLoopRun() = 0; |
+ // Called once for each thread owned by the content framework just |
+ // before and just after it is torn down. This is in reverse order |
+ // of the threads' appearance in the BrowserThread::ID enumeration, |
+ // i.e. the BrowserThread::DB thread goes last. |
+ virtual void PreStopThread(BrowserThread::ID identifier) = 0; |
+ virtual void PostStopThread(BrowserThread::ID identifier) = 0; |
+ |
+ // Called as the very last part of shutdown. |
+ virtual void FinalCleanup() = 0; |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(BrowserMainParts); |
}; |