Index: ios/web_view/internal/app/application_context_impl.h |
diff --git a/ios/web_view/internal/app/application_context_impl.h b/ios/web_view/internal/app/application_context_impl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cbd5a21e3602f9beaf5f5eba6e37c629ce209725 |
--- /dev/null |
+++ b/ios/web_view/internal/app/application_context_impl.h |
@@ -0,0 +1,67 @@ |
+// Copyright 2017 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_VIEW_INTERNAL_APP_APPLICATION_CONTEXT_IMPL_H_ |
+#define IOS_WEB_VIEW_INTERNAL_APP_APPLICATION_CONTEXT_IMPL_H_ |
+ |
+#include <memory> |
+#include <string> |
+ |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/threading/thread_checker.h" |
+#include "ios/web_view/internal/app/application_context.h" |
+ |
+namespace base { |
+class CommandLine; |
+class FilePath; |
+class SequencedTaskRunner; |
+} |
+ |
+class ApplicationContextImpl : public ApplicationContext { |
+ public: |
+ ApplicationContextImpl(const base::CommandLine& command_line, |
+ const std::string& locale); |
+ ~ApplicationContextImpl() override; |
+ |
+ // Called before the browser threads are created. |
+ void PreCreateThreads(); |
+ |
+ // Most cleanup is done by these functions, driven from WebViewWebMainParts |
Eugene But (OOO till 7-30)
2017/05/18 23:54:55
Please explain what these methods do, instead of w
michaeldo
2017/05/19 22:02:35
Done.
|
+ // rather than in the destructor, so that we can interleave cleanup with |
Eugene But (OOO till 7-30)
2017/05/18 23:54:55
nit: Avoid "we" in the comments (go/avoidwe)
michaeldo
2017/05/19 22:02:35
Done.
|
+ // threads being stopped. |
+ void StartTearDown(); |
+ void PostDestroyThreads(); |
+ |
+ // ApplicationContext implementation. |
+ PrefService* GetLocalState() override; |
+ net_log::ChromeNetLog* GetNetLog() override; |
+ net::URLRequestContextGetter* GetSystemURLRequestContext() override; |
+ const std::string& GetApplicationLocale() override; |
+ WebViewIOThread* GetWebViewIOThread() override; |
+ |
+ private: |
+ static base::FilePath LocalStatePath(); |
Eugene But (OOO till 7-30)
2017/05/18 23:54:55
GetLocalStatePath ?
michaeldo
2017/05/19 22:02:35
Done.
|
+ |
+ // Sets the locale used by the application. |
+ void SetApplicationLocale(const std::string& locale); |
+ |
+ // Create the local state. |
Eugene But (OOO till 7-30)
2017/05/18 23:54:55
This comment simply repeats the method name. Would
michaeldo
2017/05/19 22:02:35
Updated comment here and in application_context.h
|
+ void CreateLocalState(); |
+ |
+ THREAD_CHECKER(thread_checker_); |
+ std::unique_ptr<PrefService> local_state_; |
+ std::unique_ptr<net_log::ChromeNetLog> net_log_; |
+ std::unique_ptr<WebViewIOThread> web_view_io_thread_; |
+ std::string application_locale_; |
+ |
+ // Sequenced task runner for local state related I/O tasks. |
+ const scoped_refptr<base::SequencedTaskRunner> local_state_task_runner_; |
+ |
+ bool created_local_state_; |
Eugene But (OOO till 7-30)
2017/05/18 23:54:55
Why do we need a boolean? Can we check if local_st
michaeldo
2017/05/23 22:38:36
After looking into it, I removed the bool as it is
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(ApplicationContextImpl); |
+}; |
+ |
+#endif // IOS_WEB_VIEW_INTERNAL_APP_APPLICATION_CONTEXT_IMPL_H_ |