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 #include "chrome/browser/extensions/api/feedback_private/log_source_resource.h" | |
| 6 | |
| 7 #include "base/lazy_instance.h" | |
| 8 | |
| 9 namespace extensions { | |
| 10 | |
| 11 // For managing API resources of type LogSourceResource. | |
| 12 static base::LazyInstance<BrowserContextKeyedAPIFactory< | |
| 13 ApiResourceManager<LogSourceResource>>>::DestructorAtExit | |
|
tbarzic
2017/06/06 20:27:26
Can this be leaky instead?
(see https://cs.chromiu
Simon Que
2017/06/06 22:29:15
It doesn't work, results in a crash.
DestructorAt
| |
| 14 g_log_source_resource_factory = LAZY_INSTANCE_INITIALIZER; | |
| 15 | |
| 16 // static | |
| 17 template <> | |
| 18 BrowserContextKeyedAPIFactory<ApiResourceManager<LogSourceResource>>* | |
| 19 ApiResourceManager<LogSourceResource>::GetFactoryInstance() { | |
| 20 return g_log_source_resource_factory.Pointer(); | |
| 21 } | |
| 22 | |
| 23 LogSourceResource::LogSourceResource( | |
| 24 const std::string& extension_id, | |
| 25 std::unique_ptr<system_logs::SingleLogSource> source, | |
| 26 base::Closure unregister_callback) | |
| 27 : ApiResource(extension_id), | |
| 28 source_(source.release()), | |
| 29 unregister_runner_(unregister_callback) {} | |
| 30 | |
| 31 LogSourceResource::~LogSourceResource() {} | |
| 32 | |
| 33 } // namespace extensions | |
| OLD | NEW |