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

Side by Side Diff: content/child/child_thread_impl.cc

Issue 1356463002: Revert of cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/child/child_thread_impl.h" 5 #include "content/child/child_thread_impl.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 583
584 // static 584 // static
585 scoped_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory( 585 scoped_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory(
586 size_t buf_size, 586 size_t buf_size,
587 IPC::Sender* sender) { 587 IPC::Sender* sender) {
588 scoped_ptr<base::SharedMemory> shared_buf; 588 scoped_ptr<base::SharedMemory> shared_buf;
589 #if defined(OS_WIN) 589 #if defined(OS_WIN)
590 shared_buf.reset(new base::SharedMemory); 590 shared_buf.reset(new base::SharedMemory);
591 if (!shared_buf->CreateAnonymous(buf_size)) { 591 if (!shared_buf->CreateAnonymous(buf_size)) {
592 NOTREACHED(); 592 NOTREACHED();
593 return nullptr; 593 return NULL;
594 } 594 }
595 #else 595 #else
596 // On POSIX, we need to ask the browser to create the shared memory for us, 596 // On POSIX, we need to ask the browser to create the shared memory for us,
597 // since this is blocked by the sandbox. 597 // since this is blocked by the sandbox.
598 base::SharedMemoryHandle shared_mem_handle; 598 base::SharedMemoryHandle shared_mem_handle;
599 if (sender->Send(new ChildProcessHostMsg_SyncAllocateSharedMemory( 599 if (sender->Send(new ChildProcessHostMsg_SyncAllocateSharedMemory(
600 buf_size, &shared_mem_handle))) { 600 buf_size, &shared_mem_handle))) {
601 if (base::SharedMemory::IsHandleValid(shared_mem_handle)) { 601 if (base::SharedMemory::IsHandleValid(shared_mem_handle)) {
602 shared_buf.reset(new base::SharedMemory(shared_mem_handle, false)); 602 shared_buf.reset(new base::SharedMemory(shared_mem_handle, false));
603 } else { 603 } else {
604 NOTREACHED() << "Browser failed to allocate shared memory"; 604 NOTREACHED() << "Browser failed to allocate shared memory";
605 return nullptr; 605 return NULL;
606 } 606 }
607 } else if (ChildProcess::current()->GetShutDownEvent()->IsSignaled()) {
608 // Send is allowed to fail during shutdown. Return null in this case.
609 return nullptr;
610 } else { 607 } else {
611 NOTREACHED() << "Browser allocation request message failed"; 608 NOTREACHED() << "Browser allocation request message failed";
612 return nullptr; 609 return NULL;
613 } 610 }
614 #endif 611 #endif
615 return shared_buf; 612 return shared_buf;
616 } 613 }
617 614
618 bool ChildThreadImpl::OnMessageReceived(const IPC::Message& msg) { 615 bool ChildThreadImpl::OnMessageReceived(const IPC::Message& msg) {
619 if (mojo_application_->OnMessageReceived(msg)) 616 if (mojo_application_->OnMessageReceived(msg))
620 return true; 617 return true;
621 618
622 // Resource responses are sent to the resource dispatcher. 619 // Resource responses are sent to the resource dispatcher.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 void ChildThreadImpl::EnsureConnected() { 738 void ChildThreadImpl::EnsureConnected() {
742 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; 739 VLOG(0) << "ChildThreadImpl::EnsureConnected()";
743 base::Process::Current().Terminate(0, false); 740 base::Process::Current().Terminate(0, false);
744 } 741 }
745 742
746 bool ChildThreadImpl::IsInBrowserProcess() const { 743 bool ChildThreadImpl::IsInBrowserProcess() const {
747 return browser_process_io_runner_; 744 return browser_process_io_runner_;
748 } 745 }
749 746
750 } // namespace content 747 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.cc ('k') | content/renderer/gpu/compositor_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698