Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef IOS_WEB_VIEW_INTERNAL_APP_APPLICATION_CONTEXT_IMPL_H_ | |
| 6 #define IOS_WEB_VIEW_INTERNAL_APP_APPLICATION_CONTEXT_IMPL_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "base/threading/thread_checker.h" | |
| 14 #include "ios/web_view/internal/app/application_context.h" | |
| 15 | |
| 16 namespace base { | |
| 17 class CommandLine; | |
| 18 class FilePath; | |
| 19 class SequencedTaskRunner; | |
| 20 } | |
| 21 | |
| 22 class ApplicationContextImpl : public ApplicationContext { | |
| 23 public: | |
| 24 ApplicationContextImpl(const base::CommandLine& command_line, | |
| 25 const std::string& locale); | |
| 26 ~ApplicationContextImpl() override; | |
| 27 | |
| 28 // Called before the browser threads are created. | |
| 29 void PreCreateThreads(); | |
| 30 | |
| 31 // 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.
| |
| 32 // 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.
| |
| 33 // threads being stopped. | |
| 34 void StartTearDown(); | |
| 35 void PostDestroyThreads(); | |
| 36 | |
| 37 // ApplicationContext implementation. | |
| 38 PrefService* GetLocalState() override; | |
| 39 net_log::ChromeNetLog* GetNetLog() override; | |
| 40 net::URLRequestContextGetter* GetSystemURLRequestContext() override; | |
| 41 const std::string& GetApplicationLocale() override; | |
| 42 WebViewIOThread* GetWebViewIOThread() override; | |
| 43 | |
| 44 private: | |
| 45 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.
| |
| 46 | |
| 47 // Sets the locale used by the application. | |
| 48 void SetApplicationLocale(const std::string& locale); | |
| 49 | |
| 50 // 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
| |
| 51 void CreateLocalState(); | |
| 52 | |
| 53 THREAD_CHECKER(thread_checker_); | |
| 54 std::unique_ptr<PrefService> local_state_; | |
| 55 std::unique_ptr<net_log::ChromeNetLog> net_log_; | |
| 56 std::unique_ptr<WebViewIOThread> web_view_io_thread_; | |
| 57 std::string application_locale_; | |
| 58 | |
| 59 // Sequenced task runner for local state related I/O tasks. | |
| 60 const scoped_refptr<base::SequencedTaskRunner> local_state_task_runner_; | |
| 61 | |
| 62 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
| |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(ApplicationContextImpl); | |
| 65 }; | |
| 66 | |
| 67 #endif // IOS_WEB_VIEW_INTERNAL_APP_APPLICATION_CONTEXT_IMPL_H_ | |
| OLD | NEW |