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

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

Issue 2717213004: Move SharedBitmapManager implementation out of content/ (Closed)
Patch Set: rebase Created 3 years, 9 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 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 } 677 }
678 678
679 mojom::RouteProvider* ChildThreadImpl::GetRemoteRouteProvider() { 679 mojom::RouteProvider* ChildThreadImpl::GetRemoteRouteProvider() {
680 if (!remote_route_provider_) { 680 if (!remote_route_provider_) {
681 DCHECK(channel_); 681 DCHECK(channel_);
682 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); 682 channel_->GetRemoteAssociatedInterface(&remote_route_provider_);
683 } 683 }
684 return remote_route_provider_.get(); 684 return remote_route_provider_.get();
685 } 685 }
686 686
687 // static
688 std::unique_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory(
689 size_t buf_size) {
690 mojo::ScopedSharedBufferHandle mojo_buf =
691 mojo::SharedBufferHandle::Create(buf_size);
692 if (!mojo_buf->is_valid()) {
693 LOG(WARNING) << "Browser failed to allocate shared memory";
694 return nullptr;
695 }
696
697 base::SharedMemoryHandle shared_buf;
698 if (mojo::UnwrapSharedMemoryHandle(std::move(mojo_buf), &shared_buf,
699 nullptr, nullptr) != MOJO_RESULT_OK) {
700 LOG(WARNING) << "Browser failed to allocate shared memory";
701 return nullptr;
702 }
703
704 return base::MakeUnique<base::SharedMemory>(shared_buf, false);
705 }
706
707 #if defined(OS_LINUX) 687 #if defined(OS_LINUX)
708 void ChildThreadImpl::SetThreadPriority(base::PlatformThreadId id, 688 void ChildThreadImpl::SetThreadPriority(base::PlatformThreadId id,
709 base::ThreadPriority priority) { 689 base::ThreadPriority priority) {
710 Send(new ChildProcessHostMsg_SetThreadPriority(id, priority)); 690 Send(new ChildProcessHostMsg_SetThreadPriority(id, priority));
711 } 691 }
712 #endif 692 #endif
713 693
714 bool ChildThreadImpl::OnMessageReceived(const IPC::Message& msg) { 694 bool ChildThreadImpl::OnMessageReceived(const IPC::Message& msg) {
715 // Resource responses are sent to the resource dispatcher. 695 // Resource responses are sent to the resource dispatcher.
716 if (resource_dispatcher_->OnMessageReceived(msg)) 696 if (resource_dispatcher_->OnMessageReceived(msg))
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 connected_to_browser_ = true; 856 connected_to_browser_ = true;
877 child_info_ = local_info; 857 child_info_ = local_info;
878 browser_info_ = remote_info; 858 browser_info_ = remote_info;
879 } 859 }
880 860
881 bool ChildThreadImpl::IsInBrowserProcess() const { 861 bool ChildThreadImpl::IsInBrowserProcess() const {
882 return static_cast<bool>(browser_process_io_runner_); 862 return static_cast<bool>(browser_process_io_runner_);
883 } 863 }
884 864
885 } // namespace content 865 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698