refactor: use std::make_unique/base::MakeRefCounted when possible (#29637)
This commit is contained in:
parent
ebf54d7cc0
commit
56ac67e059
5 changed files with 9 additions and 5 deletions
|
@ -133,7 +133,7 @@ void CertificateManagerModel::DidGetCertDBOnUIThread(
|
||||||
CreationCallback callback) {
|
CreationCallback callback) {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
|
|
||||||
std::unique_ptr<CertificateManagerModel> model(
|
auto model = base::WrapUnique(
|
||||||
new CertificateManagerModel(cert_db, is_user_db_available));
|
new CertificateManagerModel(cert_db, is_user_db_available));
|
||||||
std::move(callback).Run(std::move(model));
|
std::move(callback).Run(std::move(model));
|
||||||
}
|
}
|
||||||
|
|
|
@ -655,7 +655,8 @@ WebContents::WebContents(v8::Isolate* isolate,
|
||||||
: content::WebContentsObserver(web_contents.get()),
|
: content::WebContentsObserver(web_contents.get()),
|
||||||
type_(type),
|
type_(type),
|
||||||
id_(GetAllWebContents().Add(this)),
|
id_(GetAllWebContents().Add(this)),
|
||||||
devtools_file_system_indexer_(new DevToolsFileSystemIndexer),
|
devtools_file_system_indexer_(
|
||||||
|
base::MakeRefCounted<DevToolsFileSystemIndexer>()),
|
||||||
file_task_runner_(
|
file_task_runner_(
|
||||||
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()}))
|
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()}))
|
||||||
#if BUILDFLAG(ENABLE_PRINTING)
|
#if BUILDFLAG(ENABLE_PRINTING)
|
||||||
|
|
|
@ -104,7 +104,7 @@ ElectronBrowserContext::ElectronBrowserContext(const std::string& partition,
|
||||||
bool in_memory,
|
bool in_memory,
|
||||||
base::DictionaryValue options)
|
base::DictionaryValue options)
|
||||||
: storage_policy_(base::MakeRefCounted<SpecialStoragePolicy>()),
|
: storage_policy_(base::MakeRefCounted<SpecialStoragePolicy>()),
|
||||||
protocol_registry_(new ProtocolRegistry),
|
protocol_registry_(base::WrapUnique(new ProtocolRegistry)),
|
||||||
in_memory_(in_memory),
|
in_memory_(in_memory),
|
||||||
ssl_config_(network::mojom::SSLConfig::New()) {
|
ssl_config_(network::mojom::SSLConfig::New()) {
|
||||||
user_agent_ = ElectronBrowserClient::Get()->GetUserAgent();
|
user_agent_ = ElectronBrowserClient::Get()->GetUserAgent();
|
||||||
|
|
|
@ -49,7 +49,8 @@ namespace extensions {
|
||||||
ElectronExtensionSystem::ElectronExtensionSystem(
|
ElectronExtensionSystem::ElectronExtensionSystem(
|
||||||
BrowserContext* browser_context)
|
BrowserContext* browser_context)
|
||||||
: browser_context_(browser_context),
|
: browser_context_(browser_context),
|
||||||
store_factory_(new ValueStoreFactoryImpl(browser_context->GetPath())) {}
|
store_factory_(base::MakeRefCounted<ValueStoreFactoryImpl>(
|
||||||
|
browser_context->GetPath())) {}
|
||||||
|
|
||||||
ElectronExtensionSystem::~ElectronExtensionSystem() = default;
|
ElectronExtensionSystem::~ElectronExtensionSystem() = default;
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,9 @@ void InvokeIpcCallback(v8::Local<v8::Context> context,
|
||||||
node::Environment* env = node::Environment::GetCurrent(context);
|
node::Environment* env = node::Environment::GetCurrent(context);
|
||||||
std::unique_ptr<node::CallbackScope> callback_scope;
|
std::unique_ptr<node::CallbackScope> callback_scope;
|
||||||
if (env) {
|
if (env) {
|
||||||
callback_scope.reset(new node::CallbackScope(isolate, ipcNative, {0, 0}));
|
node::async_context async_context = {};
|
||||||
|
callback_scope = std::make_unique<node::CallbackScope>(isolate, ipcNative,
|
||||||
|
async_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto callback_key = gin::ConvertToV8(isolate, callback_name)
|
auto callback_key = gin::ConvertToV8(isolate, callback_name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue