| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/public/browser/browser_thread.h" | |
| 12 | 11 |
| 13 namespace content { | 12 namespace content { |
| 14 | 13 |
| 15 // This class contains different "stages" to be executed by |BrowserMain()|, | 14 // This class contains different "stages" to be executed by |BrowserMain()|, |
| 16 // Each stage is represented by a single BrowserMainParts method, called from | 15 // Each stage is represented by a single BrowserMainParts method, called from |
| 17 // the corresponding method in |BrowserMainLoop| (e.g., EarlyInitialization()) | 16 // the corresponding method in |BrowserMainLoop| (e.g., EarlyInitialization()) |
| 18 // which does the following: | 17 // which does the following: |
| 19 // - calls a method (e.g., "PreEarlyInitialization()") which implements | 18 // - calls a method (e.g., "PreEarlyInitialization()") which implements |
| 20 // platform / tookit specific code for that stage. | 19 // platform / tookit specific code for that stage. |
| 21 // - calls various methods for things common to all platforms (for that stage). | 20 // - calls various methods for things common to all platforms (for that stage). |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 57 |
| 59 virtual void PostEarlyInitialization() = 0; | 58 virtual void PostEarlyInitialization() = 0; |
| 60 | 59 |
| 61 virtual void PreMainMessageLoopStart() = 0; | 60 virtual void PreMainMessageLoopStart() = 0; |
| 62 | 61 |
| 63 virtual void PostMainMessageLoopStart() = 0; | 62 virtual void PostMainMessageLoopStart() = 0; |
| 64 | 63 |
| 65 // Allows an embedder to do any extra toolkit initialization. | 64 // Allows an embedder to do any extra toolkit initialization. |
| 66 virtual void ToolkitInitialized() = 0; | 65 virtual void ToolkitInitialized() = 0; |
| 67 | 66 |
| 68 // Called just before any child threads owned by the content | |
| 69 // framework are created. | |
| 70 // | |
| 71 // The main message loop has been started at this point (but has not | |
| 72 // been run), and the toolkit has been initialized. | |
| 73 virtual void PreCreateThreads() = 0; | |
| 74 | |
| 75 // Called once for each thread owned by the content framework just | |
| 76 // before and just after the thread object is created and started. | |
| 77 // This happens in the order of the threads' appearence in the | |
| 78 // BrowserThread::ID enumeration. Note that there will be no such | |
| 79 // call for BrowserThread::UI, since it is the main thread of the | |
| 80 // application. | |
| 81 virtual void PreStartThread(BrowserThread::ID identifier) = 0; | |
| 82 virtual void PostStartThread(BrowserThread::ID identifier) = 0; | |
| 83 | |
| 84 // This is called just before the main message loop is run. The | |
| 85 // various browser threads have all been created at this point | |
| 86 virtual void PreMainMessageLoopRun() = 0; | 67 virtual void PreMainMessageLoopRun() = 0; |
| 87 | 68 |
| 88 // Returns true if the message loop was run, false otherwise. | 69 // Returns true if the message loop was run, false otherwise. |
| 89 // If this returns false, the default implementation will be run. | 70 // If this returns false, the default implementation will be run. |
| 90 // May set |result_code|, which will be returned by |BrowserMain()|. | 71 // May set |result_code|, which will be returned by |BrowserMain()|. |
| 91 virtual bool MainMessageLoopRun(int* result_code) = 0; | 72 virtual bool MainMessageLoopRun(int* result_code) = 0; |
| 92 | 73 |
| 93 // This happens after the main message loop has stopped, but before | |
| 94 // threads are stopped. | |
| 95 virtual void PostMainMessageLoopRun() = 0; | 74 virtual void PostMainMessageLoopRun() = 0; |
| 96 | 75 |
| 97 // Called once for each thread owned by the content framework just | |
| 98 // before and just after it is torn down. This is in reverse order | |
| 99 // of the threads' appearance in the BrowserThread::ID enumeration. | |
| 100 // Note that you will not receive such a call for BrowserThread::UI, | |
| 101 // since it is the main thread of the application. | |
| 102 virtual void PreStopThread(BrowserThread::ID identifier) = 0; | |
| 103 virtual void PostStopThread(BrowserThread::ID identifier) = 0; | |
| 104 | |
| 105 // Called as the very last part of shutdown, after threads have been | |
| 106 // stopped and destroyed. | |
| 107 virtual void PostDestroyThreads() = 0; | |
| 108 | |
| 109 private: | 76 private: |
| 110 DISALLOW_COPY_AND_ASSIGN(BrowserMainParts); | 77 DISALLOW_COPY_AND_ASSIGN(BrowserMainParts); |
| 111 }; | 78 }; |
| 112 | 79 |
| 113 } // namespace content | 80 } // namespace content |
| 114 | 81 |
| 115 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_ | 82 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_ |
| OLD | NEW |