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

Unified Diff: ios/web/app/web_main_loop.h

Issue 1149323004: Upstream the iOS web_shell and supporting code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web-thread-impl
Patch Set: Address review comments Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/app/web_main.mm ('k') | ios/web/app/web_main_loop.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/app/web_main_loop.h
diff --git a/ios/web/app/web_main_loop.h b/ios/web/app/web_main_loop.h
new file mode 100644
index 0000000000000000000000000000000000000000..8fd9178efabe667792249f28985f3e06e9aad00b
--- /dev/null
+++ b/ios/web/app/web_main_loop.h
@@ -0,0 +1,99 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_WEB_APP_WEB_MAIN_LOOP_H_
+#define IOS_WEB_APP_WEB_MAIN_LOOP_H_
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace base {
+class CommandLine;
+class FilePath;
+class MessageLoop;
+class PowerMonitor;
+class SystemMonitor;
+} // namespace base
+
+namespace net {
+class NetworkChangeNotifier;
+} // namespace net
+
+namespace web {
+class CookieNotificationBridge;
+class WebMainParts;
+class WebThreadImpl;
+
+// Implements the main web loop stages called from WebMainRunner.
+// See comments in web_main_parts.h for additional info.
+class WebMainLoop {
+ public:
+ explicit WebMainLoop();
+ virtual ~WebMainLoop();
+
+ void Init();
+
+ void EarlyInitialization();
+ void MainMessageLoopStart();
+
+ // Creates and starts running the tasks needed to complete startup.
+ void CreateStartupTasks();
+
+ // Performs the shutdown sequence, starting with PostMainMessageLoopRun
+ // through stopping threads to PostDestroyThreads.
+ void ShutdownThreadsAndCleanUp();
+
+ int GetResultCode() const { return result_code_; }
+
+ private:
+ void InitializeMainThread();
+
+ // Called just before creating the threads
+ int PreCreateThreads();
+
+ // Creates all secondary threads.
+ int CreateThreads();
+
+ // Called right after the web threads have been started.
+ int WebThreadsStarted();
+
+ // Called just before attaching to the main message loop.
+ int PreMainMessageLoopRun();
+
+ // Members initialized on construction ---------------------------------------
+ int result_code_;
+ // True if the non-UI threads were created.
+ bool created_threads_;
+
+ // Members initialized in |MainMessageLoopStart()| ---------------------------
+ scoped_ptr<base::MessageLoop> main_message_loop_;
+ scoped_ptr<base::SystemMonitor> system_monitor_;
+ scoped_ptr<base::PowerMonitor> power_monitor_;
+ scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
+
+ // Destroy parts_ before main_message_loop_ (required) and before other
+ // classes constructed in web (but after main_thread_).
+ scoped_ptr<WebMainParts> parts_;
+
+ // Members initialized in |InitializeMainThread()| ---------------------------
+ // This must get destroyed before other threads that are created in parts_.
+ scoped_ptr<WebThreadImpl> main_thread_;
+
+ // Members initialized in |RunMainMessageLoopParts()| ------------------------
+ scoped_ptr<WebThreadImpl> db_thread_;
+ scoped_ptr<WebThreadImpl> file_user_blocking_thread_;
+ scoped_ptr<WebThreadImpl> file_thread_;
+ scoped_ptr<WebThreadImpl> cache_thread_;
+ scoped_ptr<WebThreadImpl> io_thread_;
+
+ // Members initialized in |WebThreadsStarted()| --------------------------
+ scoped_ptr<CookieNotificationBridge> cookie_notification_bridge_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebMainLoop);
+};
+
+} // namespace web
+
+#endif // IOS_WEB_APP_WEB_MAIN_LOOP_H_
« no previous file with comments | « ios/web/app/web_main.mm ('k') | ios/web/app/web_main_loop.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698