| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "headless/lib/browser/headless_browser_impl.h" | 5 #include "headless/lib/browser/headless_browser_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 HeadlessBrowserImpl::~HeadlessBrowserImpl() {} | 57 HeadlessBrowserImpl::~HeadlessBrowserImpl() {} |
| 58 | 58 |
| 59 HeadlessBrowserContext::Builder | 59 HeadlessBrowserContext::Builder |
| 60 HeadlessBrowserImpl::CreateBrowserContextBuilder() { | 60 HeadlessBrowserImpl::CreateBrowserContextBuilder() { |
| 61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 62 return HeadlessBrowserContext::Builder(this); | 62 return HeadlessBrowserContext::Builder(this); |
| 63 } | 63 } |
| 64 | 64 |
| 65 scoped_refptr<base::SingleThreadTaskRunner> | 65 scoped_refptr<base::SingleThreadTaskRunner> |
| 66 HeadlessBrowserImpl::BrowserFileThread() const { |
| 67 return content::BrowserThread::GetTaskRunnerForThread( |
| 68 content::BrowserThread::FILE); |
| 69 } |
| 70 |
| 71 scoped_refptr<base::SingleThreadTaskRunner> |
| 72 HeadlessBrowserImpl::BrowserIOThread() const { |
| 73 return content::BrowserThread::GetTaskRunnerForThread( |
| 74 content::BrowserThread::IO); |
| 75 } |
| 76 |
| 77 scoped_refptr<base::SingleThreadTaskRunner> |
| 66 HeadlessBrowserImpl::BrowserMainThread() const { | 78 HeadlessBrowserImpl::BrowserMainThread() const { |
| 67 return content::BrowserThread::GetTaskRunnerForThread( | 79 return content::BrowserThread::GetTaskRunnerForThread( |
| 68 content::BrowserThread::UI); | 80 content::BrowserThread::UI); |
| 69 } | 81 } |
| 70 | 82 |
| 71 scoped_refptr<base::SingleThreadTaskRunner> | |
| 72 HeadlessBrowserImpl::BrowserFileThread() const { | |
| 73 return content::BrowserThread::GetTaskRunnerForThread( | |
| 74 content::BrowserThread::FILE); | |
| 75 } | |
| 76 | |
| 77 void HeadlessBrowserImpl::Shutdown() { | 83 void HeadlessBrowserImpl::Shutdown() { |
| 78 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 84 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 79 | 85 |
| 80 weak_ptr_factory_.InvalidateWeakPtrs(); | 86 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 81 | 87 |
| 82 // Destroy all browser contexts. | 88 // Destroy all browser contexts. |
| 83 browser_contexts_.clear(); | 89 browser_contexts_.clear(); |
| 84 | 90 |
| 85 BrowserMainThread()->PostTask(FROM_HERE, | 91 BrowserMainThread()->PostTask(FROM_HERE, |
| 86 base::MessageLoop::QuitWhenIdleClosure()); | 92 base::MessageLoop::QuitWhenIdleClosure()); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 205 |
| 200 // Child processes should not end up here. | 206 // Child processes should not end up here. |
| 201 base::CommandLine command_line(options.argc, options.argv); | 207 base::CommandLine command_line(options.argc, options.argv); |
| 202 DCHECK(!command_line.HasSwitch(switches::kProcessType)); | 208 DCHECK(!command_line.HasSwitch(switches::kProcessType)); |
| 203 #endif | 209 #endif |
| 204 return RunContentMain(std::move(options), | 210 return RunContentMain(std::move(options), |
| 205 std::move(on_browser_start_callback)); | 211 std::move(on_browser_start_callback)); |
| 206 } | 212 } |
| 207 | 213 |
| 208 } // namespace headless | 214 } // namespace headless |
| OLD | NEW |