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

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

Issue 2459733002: Move discardable memory to //components from //content (Closed)
Patch Set: Fix build error Created 4 years, 1 month 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
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/child/child_thread_impl_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 14 matching lines...) Expand all
25 #include "base/single_thread_task_runner.h" 25 #include "base/single_thread_task_runner.h"
26 #include "base/strings/string_number_conversions.h" 26 #include "base/strings/string_number_conversions.h"
27 #include "base/strings/string_util.h" 27 #include "base/strings/string_util.h"
28 #include "base/synchronization/condition_variable.h" 28 #include "base/synchronization/condition_variable.h"
29 #include "base/synchronization/lock.h" 29 #include "base/synchronization/lock.h"
30 #include "base/threading/thread_local.h" 30 #include "base/threading/thread_local.h"
31 #include "base/threading/thread_task_runner_handle.h" 31 #include "base/threading/thread_task_runner_handle.h"
32 #include "base/timer/elapsed_timer.h" 32 #include "base/timer/elapsed_timer.h"
33 #include "base/tracked_objects.h" 33 #include "base/tracked_objects.h"
34 #include "build/build_config.h" 34 #include "build/build_config.h"
35 #include "components/discardable_memory/client/client_discardable_shared_memory_ manager.h"
35 #include "components/tracing/child/child_trace_message_filter.h" 36 #include "components/tracing/child/child_trace_message_filter.h"
36 #include "content/child/child_discardable_shared_memory_manager.h"
37 #include "content/child/child_histogram_message_filter.h" 37 #include "content/child/child_histogram_message_filter.h"
38 #include "content/child/child_process.h" 38 #include "content/child/child_process.h"
39 #include "content/child/child_resource_message_filter.h" 39 #include "content/child/child_resource_message_filter.h"
40 #include "content/child/child_shared_bitmap_manager.h" 40 #include "content/child/child_shared_bitmap_manager.h"
41 #include "content/child/fileapi/file_system_dispatcher.h" 41 #include "content/child/fileapi/file_system_dispatcher.h"
42 #include "content/child/fileapi/webfilesystem_impl.h" 42 #include "content/child/fileapi/webfilesystem_impl.h"
43 #include "content/child/memory/child_memory_message_filter.h" 43 #include "content/child/memory/child_memory_message_filter.h"
44 #include "content/child/notifications/notification_dispatcher.h" 44 #include "content/child/notifications/notification_dispatcher.h"
45 #include "content/child/power_monitor_broadcast_source.h" 45 #include "content/child/power_monitor_broadcast_source.h"
46 #include "content/child/push_messaging/push_dispatcher.h" 46 #include "content/child/push_messaging/push_dispatcher.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 #if defined(OS_ANDROID) 347 #if defined(OS_ANDROID)
348 if (!handled && msg.is_sync()) { 348 if (!handled && msg.is_sync()) {
349 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); 349 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg);
350 reply->set_reply_error(); 350 reply->set_reply_error();
351 Send(reply); 351 Send(reply);
352 } 352 }
353 #endif 353 #endif
354 return handled; 354 return handled;
355 } 355 }
356 356
357 class ChildThreadImpl::ClientDiscardableSharedMemoryManagerDelegate
358 : public discardable_memory::ClientDiscardableSharedMemoryManager::
359 Delegate {
360 public:
361 explicit ClientDiscardableSharedMemoryManagerDelegate(
362 scoped_refptr<ThreadSafeSender> sender)
363 : sender_(sender) {}
364 ~ClientDiscardableSharedMemoryManagerDelegate() override {}
365
366 void AllocateLockedDiscardableSharedMemory(
367 size_t size,
368 discardable_memory::DiscardableSharedMemoryId id,
369 base::SharedMemoryHandle* handle) override {
370 sender_->Send(
371 new ChildProcessHostMsg_SyncAllocateLockedDiscardableSharedMemory(
372 size, id, handle));
373 }
374
375 void DeletedDiscardableSharedMemory(
376 discardable_memory::DiscardableSharedMemoryId id) override {
377 sender_->Send(new ChildProcessHostMsg_DeletedDiscardableSharedMemory(id));
378 }
379
380 private:
381 scoped_refptr<ThreadSafeSender> sender_;
382 };
383
357 ChildThreadImpl::ChildThreadImpl() 384 ChildThreadImpl::ChildThreadImpl()
358 : route_provider_binding_(this), 385 : route_provider_binding_(this),
359 associated_interface_provider_bindings_( 386 associated_interface_provider_bindings_(
360 mojo::BindingSetDispatchMode::WITH_CONTEXT), 387 mojo::BindingSetDispatchMode::WITH_CONTEXT),
361 router_(this), 388 router_(this),
362 channel_connected_factory_( 389 channel_connected_factory_(
363 new base::WeakPtrFactory<ChildThreadImpl>(this)), 390 new base::WeakPtrFactory<ChildThreadImpl>(this)),
364 weak_factory_(this) { 391 weak_factory_(this) {
365 Init(Options::Builder().Build()); 392 Init(Options::Builder().Build());
366 } 393 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 channel_connected_factory_->GetWeakPtr()), 584 channel_connected_factory_->GetWeakPtr()),
558 base::TimeDelta::FromSeconds(connection_timeout)); 585 base::TimeDelta::FromSeconds(connection_timeout));
559 586
560 #if defined(OS_ANDROID) 587 #if defined(OS_ANDROID)
561 g_quit_closure.Get().BindToMainThread(); 588 g_quit_closure.Get().BindToMainThread();
562 #endif 589 #endif
563 590
564 shared_bitmap_manager_.reset( 591 shared_bitmap_manager_.reset(
565 new ChildSharedBitmapManager(thread_safe_sender())); 592 new ChildSharedBitmapManager(thread_safe_sender()));
566 593
567 discardable_shared_memory_manager_.reset( 594 client_discardable_shared_memory_manager_delegate_ =
568 new ChildDiscardableSharedMemoryManager(thread_safe_sender())); 595 base::MakeUnique<ClientDiscardableSharedMemoryManagerDelegate>(
596 thread_safe_sender());
597 discardable_shared_memory_manager_ = base::MakeUnique<
598 discardable_memory::ClientDiscardableSharedMemoryManager>(
599 client_discardable_shared_memory_manager_delegate_.get());
569 } 600 }
570 601
571 ChildThreadImpl::~ChildThreadImpl() { 602 ChildThreadImpl::~ChildThreadImpl() {
572 #ifdef IPC_MESSAGE_LOG_ENABLED 603 #ifdef IPC_MESSAGE_LOG_ENABLED
573 IPC::Logging::GetInstance()->SetIPCSender(NULL); 604 IPC::Logging::GetInstance()->SetIPCSender(NULL);
574 #endif 605 #endif
575 606
576 channel_->RemoveFilter(histogram_message_filter_.get()); 607 channel_->RemoveFilter(histogram_message_filter_.get());
577 channel_->RemoveFilter(sync_message_filter_.get()); 608 channel_->RemoveFilter(sync_message_filter_.get());
578 609
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 connected_to_browser_ = true; 917 connected_to_browser_ = true;
887 child_info_ = local_info; 918 child_info_ = local_info;
888 browser_info_ = remote_info; 919 browser_info_ = remote_info;
889 } 920 }
890 921
891 bool ChildThreadImpl::IsInBrowserProcess() const { 922 bool ChildThreadImpl::IsInBrowserProcess() const {
892 return static_cast<bool>(browser_process_io_runner_); 923 return static_cast<bool>(browser_process_io_runner_);
893 } 924 }
894 925
895 } // namespace content 926 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/child/child_thread_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698