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

Side by Side Diff: content/common/host_discardable_shared_memory_manager.cc

Issue 1134113002: content/common: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix CrOS build. Created 5 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 "content/common/host_discardable_shared_memory_manager.h" 5 #include "content/common/host_discardable_shared_memory_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/debug/crash_logging.h" 12 #include "base/debug/crash_logging.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/memory/discardable_memory.h" 14 #include "base/memory/discardable_memory.h"
15 #include "base/numerics/safe_math.h" 15 #include "base/numerics/safe_math.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/sys_info.h" 17 #include "base/sys_info.h"
18 #include "base/thread_task_runner_handle.h"
18 #include "base/trace_event/trace_event.h" 19 #include "base/trace_event/trace_event.h"
19 20
20 namespace content { 21 namespace content {
21 namespace { 22 namespace {
22 23
23 class DiscardableMemoryImpl : public base::DiscardableMemory { 24 class DiscardableMemoryImpl : public base::DiscardableMemory {
24 public: 25 public:
25 DiscardableMemoryImpl(scoped_ptr<base::DiscardableSharedMemory> shared_memory, 26 DiscardableMemoryImpl(scoped_ptr<base::DiscardableSharedMemory> shared_memory,
26 const base::Closure& deleted_callback) 27 const base::Closure& deleted_callback)
27 : shared_memory_(shared_memory.Pass()), 28 : shared_memory_(shared_memory.Pass()),
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 return base::Time::Now(); 383 return base::Time::Now();
383 } 384 }
384 385
385 void HostDiscardableSharedMemoryManager::ScheduleEnforceMemoryPolicy() { 386 void HostDiscardableSharedMemoryManager::ScheduleEnforceMemoryPolicy() {
386 lock_.AssertAcquired(); 387 lock_.AssertAcquired();
387 388
388 if (enforce_memory_policy_pending_) 389 if (enforce_memory_policy_pending_)
389 return; 390 return;
390 391
391 enforce_memory_policy_pending_ = true; 392 enforce_memory_policy_pending_ = true;
392 base::MessageLoop::current()->PostDelayedTask( 393 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
393 FROM_HERE, 394 FROM_HERE,
394 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy, 395 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy,
395 weak_ptr_factory_.GetWeakPtr()), 396 weak_ptr_factory_.GetWeakPtr()),
396 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs)); 397 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs));
397 } 398 }
398 399
399 } // namespace content 400 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/vt_video_decode_accelerator.cc ('k') | content/common/mojo/channel_init.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698