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_context_impl.h" | 5 #include "headless/lib/browser/headless_browser_context_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 HeadlessBrowserContextImpl::HeadlessBrowserContextImpl( | 69 HeadlessBrowserContextImpl::HeadlessBrowserContextImpl( |
70 ProtocolHandlerMap protocol_handlers, | 70 ProtocolHandlerMap protocol_handlers, |
71 HeadlessBrowser::Options* options) | 71 HeadlessBrowser::Options* options) |
72 : protocol_handlers_(std::move(protocol_handlers)), | 72 : protocol_handlers_(std::move(protocol_handlers)), |
73 options_(options), | 73 options_(options), |
74 resource_context_(new HeadlessResourceContext) { | 74 resource_context_(new HeadlessResourceContext) { |
75 InitWhileIOAllowed(); | 75 InitWhileIOAllowed(); |
76 } | 76 } |
77 | 77 |
78 HeadlessBrowserContextImpl::~HeadlessBrowserContextImpl() { | 78 HeadlessBrowserContextImpl::~HeadlessBrowserContextImpl() { |
| 79 ShutdownStoragePartitions(); |
79 if (resource_context_) { | 80 if (resource_context_) { |
80 content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE, | 81 content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE, |
81 resource_context_.release()); | 82 resource_context_.release()); |
82 } | 83 } |
83 } | 84 } |
84 | 85 |
85 // static | 86 // static |
86 HeadlessBrowserContextImpl* HeadlessBrowserContextImpl::From( | 87 HeadlessBrowserContextImpl* HeadlessBrowserContextImpl::From( |
87 HeadlessBrowserContext* browser_context) { | 88 HeadlessBrowserContext* browser_context) { |
88 return reinterpret_cast<HeadlessBrowserContextImpl*>(browser_context); | 89 return reinterpret_cast<HeadlessBrowserContextImpl*>(browser_context); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 return *this; | 203 return *this; |
203 } | 204 } |
204 | 205 |
205 std::unique_ptr<HeadlessBrowserContext> | 206 std::unique_ptr<HeadlessBrowserContext> |
206 HeadlessBrowserContext::Builder::Build() { | 207 HeadlessBrowserContext::Builder::Build() { |
207 return base::WrapUnique(new HeadlessBrowserContextImpl( | 208 return base::WrapUnique(new HeadlessBrowserContextImpl( |
208 std::move(protocol_handlers_), browser_->options())); | 209 std::move(protocol_handlers_), browser_->options())); |
209 } | 210 } |
210 | 211 |
211 } // namespace headless | 212 } // namespace headless |
OLD | NEW |