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 2852803002: Remove base::SharedMemory::ShareToProcess. (Closed)
Patch Set: Rebase. Created 3 years, 7 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 if (!ExtensionsBrowserClient::Get()->IsSameContext( 409 if (!ExtensionsBrowserClient::Get()->IsSameContext(
410 browser_context_, process->GetBrowserContext())) 410 browser_context_, process->GetBrowserContext()))
411 return; 411 return;
412 412
413 // If the process is being started asynchronously, early return. We'll end up 413 // If the process is being started asynchronously, early return. We'll end up
414 // calling InitUserScripts when it's created which will call this again. 414 // calling InitUserScripts when it's created which will call this again.
415 base::ProcessHandle handle = process->GetHandle(); 415 base::ProcessHandle handle = process->GetHandle();
416 if (!handle) 416 if (!handle)
417 return; 417 return;
418 418
419 base::SharedMemoryHandle handle_for_process; 419 base::SharedMemoryHandle handle_for_process =
420 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) 420 shared_memory->handle().Duplicate();
421 return; // This can legitimately fail if the renderer asserts at startup. 421 if (!handle_for_process.IsValid())
422 return;
422 423
423 if (base::SharedMemory::IsHandleValid(handle_for_process)) { 424 if (base::SharedMemory::IsHandleValid(handle_for_process)) {
Nico 2017/05/02 20:08:00 Is this just an alias for handle_for_process.isVal
erikchen 2017/05/02 21:33:10 Yes. We could do a whole other refactor to make th
424 process->Send(new ExtensionMsg_UpdateUserScripts( 425 process->Send(new ExtensionMsg_UpdateUserScripts(
425 handle_for_process, host_id(), changed_hosts, whitelisted_only)); 426 handle_for_process, host_id(), changed_hosts, whitelisted_only));
426 } 427 }
427 } 428 }
428 429
429 } // namespace extensions 430 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698