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

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

Issue 1135943005: Revert of content/common: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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"
19 #include "base/trace_event/trace_event.h" 18 #include "base/trace_event/trace_event.h"
20 19
21 namespace content { 20 namespace content {
22 namespace { 21 namespace {
23 22
24 class DiscardableMemoryImpl : public base::DiscardableMemory { 23 class DiscardableMemoryImpl : public base::DiscardableMemory {
25 public: 24 public:
26 DiscardableMemoryImpl(scoped_ptr<base::DiscardableSharedMemory> shared_memory, 25 DiscardableMemoryImpl(scoped_ptr<base::DiscardableSharedMemory> shared_memory,
27 const base::Closure& deleted_callback) 26 const base::Closure& deleted_callback)
28 : shared_memory_(shared_memory.Pass()), 27 : shared_memory_(shared_memory.Pass()),
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 return base::Time::Now(); 382 return base::Time::Now();
384 } 383 }
385 384
386 void HostDiscardableSharedMemoryManager::ScheduleEnforceMemoryPolicy() { 385 void HostDiscardableSharedMemoryManager::ScheduleEnforceMemoryPolicy() {
387 lock_.AssertAcquired(); 386 lock_.AssertAcquired();
388 387
389 if (enforce_memory_policy_pending_) 388 if (enforce_memory_policy_pending_)
390 return; 389 return;
391 390
392 enforce_memory_policy_pending_ = true; 391 enforce_memory_policy_pending_ = true;
393 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 392 base::MessageLoop::current()->PostDelayedTask(
394 FROM_HERE, 393 FROM_HERE,
395 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy, 394 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy,
396 weak_ptr_factory_.GetWeakPtr()), 395 weak_ptr_factory_.GetWeakPtr()),
397 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs)); 396 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs));
398 } 397 }
399 398
400 } // namespace content 399 } // 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