Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: extensions/browser/user_script_loader.cc

Issue 2252373002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/user_script_loader.h" 5 #include "extensions/browser/user_script_loader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 return std::unique_ptr<base::SharedMemory>(); 327 return std::unique_ptr<base::SharedMemory>();
328 328
329 // Copy the pickle to shared memory. 329 // Copy the pickle to shared memory.
330 memcpy(shared_memory.memory(), pickle.data(), pickle.size()); 330 memcpy(shared_memory.memory(), pickle.data(), pickle.size());
331 331
332 base::SharedMemoryHandle readonly_handle; 332 base::SharedMemoryHandle readonly_handle;
333 if (!shared_memory.ShareReadOnlyToProcess(base::GetCurrentProcessHandle(), 333 if (!shared_memory.ShareReadOnlyToProcess(base::GetCurrentProcessHandle(),
334 &readonly_handle)) 334 &readonly_handle))
335 return std::unique_ptr<base::SharedMemory>(); 335 return std::unique_ptr<base::SharedMemory>();
336 336
337 return base::WrapUnique(new base::SharedMemory(readonly_handle, 337 return base::MakeUnique<base::SharedMemory>(readonly_handle,
338 /*read_only=*/true)); 338 /*read_only=*/true);
339 } 339 }
340 340
341 void UserScriptLoader::AddObserver(Observer* observer) { 341 void UserScriptLoader::AddObserver(Observer* observer) {
342 observers_.AddObserver(observer); 342 observers_.AddObserver(observer);
343 } 343 }
344 344
345 void UserScriptLoader::RemoveObserver(Observer* observer) { 345 void UserScriptLoader::RemoveObserver(Observer* observer) {
346 observers_.RemoveObserver(observer); 346 observers_.RemoveObserver(observer);
347 } 347 }
348 348
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) 417 if (!shared_memory->ShareToProcess(handle, &handle_for_process))
418 return; // This can legitimately fail if the renderer asserts at startup. 418 return; // This can legitimately fail if the renderer asserts at startup.
419 419
420 if (base::SharedMemory::IsHandleValid(handle_for_process)) { 420 if (base::SharedMemory::IsHandleValid(handle_for_process)) {
421 process->Send(new ExtensionMsg_UpdateUserScripts( 421 process->Send(new ExtensionMsg_UpdateUserScripts(
422 handle_for_process, host_id(), changed_hosts, whitelisted_only)); 422 handle_for_process, host_id(), changed_hosts, whitelisted_only));
423 } 423 }
424 } 424 }
425 425
426 } // namespace extensions 426 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/mojo/stash_backend.cc ('k') | extensions/browser/value_store/legacy_value_store_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698