| 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" |
| 11 | 12 |
| 12 namespace content { | 13 namespace content { |
| 13 | 14 |
| 14 // This class contains different "stages" to be executed by |BrowserMain()|, | 15 // This class contains different "stages" to be executed by |BrowserMain()|, |
| 15 // Each stage is represented by a single BrowserMainParts method, called from | 16 // Each stage is represented by a single BrowserMainParts method, called from |
| 16 // the corresponding method in |BrowserMainLoop| (e.g., EarlyInitialization()) | 17 // the corresponding method in |BrowserMainLoop| (e.g., EarlyInitialization()) |
| 17 // which does the following: | 18 // which does the following: |
| 18 // - calls a method (e.g., "PreEarlyInitialization()") which implements | 19 // - calls a method (e.g., "PreEarlyInitialization()") which implements |
| 19 // platform / tookit specific code for that stage. | 20 // platform / tookit specific code for that stage. |
| 20 // - calls various methods for things common to all platforms (for that stage). | 21 // - 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... |
| 57 | 58 |
| 58 virtual void PostEarlyInitialization() = 0; | 59 virtual void PostEarlyInitialization() = 0; |
| 59 | 60 |
| 60 virtual void PreMainMessageLoopStart() = 0; | 61 virtual void PreMainMessageLoopStart() = 0; |
| 61 | 62 |
| 62 virtual void PostMainMessageLoopStart() = 0; | 63 virtual void PostMainMessageLoopStart() = 0; |
| 63 | 64 |
| 64 // Allows an embedder to do any extra toolkit initialization. | 65 // Allows an embedder to do any extra toolkit initialization. |
| 65 virtual void ToolkitInitialized() = 0; | 66 virtual void ToolkitInitialized() = 0; |
| 66 | 67 |
| 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 |
| 67 virtual void PreMainMessageLoopRun() = 0; | 86 virtual void PreMainMessageLoopRun() = 0; |
| 68 | 87 |
| 69 // Returns true if the message loop was run, false otherwise. | 88 // Returns true if the message loop was run, false otherwise. |
| 70 // If this returns false, the default implementation will be run. | 89 // If this returns false, the default implementation will be run. |
| 71 // May set |result_code|, which will be returned by |BrowserMain()|. | 90 // May set |result_code|, which will be returned by |BrowserMain()|. |
| 72 virtual bool MainMessageLoopRun(int* result_code) = 0; | 91 virtual bool MainMessageLoopRun(int* result_code) = 0; |
| 73 | 92 |
| 93 // This happens after the main message loop has stopped, but before |
| 94 // threads are stopped. |
| 74 virtual void PostMainMessageLoopRun() = 0; | 95 virtual void PostMainMessageLoopRun() = 0; |
| 75 | 96 |
| 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 |
| 76 private: | 109 private: |
| 77 DISALLOW_COPY_AND_ASSIGN(BrowserMainParts); | 110 DISALLOW_COPY_AND_ASSIGN(BrowserMainParts); |
| 78 }; | 111 }; |
| 79 | 112 |
| 80 } // namespace content | 113 } // namespace content |
| 81 | 114 |
| 82 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_ | 115 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_ |
| OLD | NEW |