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

Side by Side Diff: content/browser/browser_thread_impl.cc

Issue 815183002: Using the new MemoryPressureListener instead of the LowMemoryObserver when the enhanced memory mana… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Solved addressability problem Created 6 years 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/browser/browser_thread_impl.h" 5 #include "content/browser/browser_thread_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/message_loop/message_loop_proxy.h" 14 #include "base/message_loop/message_loop_proxy.h"
15 #include "base/threading/sequenced_worker_pool.h" 15 #include "base/threading/sequenced_worker_pool.h"
16 #include "base/threading/thread_restrictions.h" 16 #include "base/threading/thread_restrictions.h"
17 #include "content/browser/browser_main_loop.h"
17 #include "content/public/browser/browser_thread_delegate.h" 18 #include "content/public/browser/browser_thread_delegate.h"
18 #include "net/disk_cache/simple/simple_backend_impl.h" 19 #include "net/disk_cache/simple/simple_backend_impl.h"
19 20
20 #if defined(OS_ANDROID) 21 #if defined(OS_ANDROID)
21 #include "base/android/jni_android.h" 22 #include "base/android/jni_android.h"
22 #endif 23 #endif
23 24
24 namespace content { 25 namespace content {
25 26
26 namespace { 27 namespace {
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 bool BrowserThread::PostTaskAndReply( 474 bool BrowserThread::PostTaskAndReply(
474 ID identifier, 475 ID identifier,
475 const tracked_objects::Location& from_here, 476 const tracked_objects::Location& from_here,
476 const base::Closure& task, 477 const base::Closure& task,
477 const base::Closure& reply) { 478 const base::Closure& reply) {
478 return GetMessageLoopProxyForThread(identifier)->PostTaskAndReply(from_here, 479 return GetMessageLoopProxyForThread(identifier)->PostTaskAndReply(from_here,
479 task, 480 task,
480 reply); 481 reply);
481 } 482 }
482 483
484 #if defined(OS_CHROMEOS)
485 // static
486 base::MemoryPressureObserverChromeOS* GetMemoryPressureObserver() {
piman 2014/12/20 02:53:15 This doesn't match the new method in the header, w
Mr4D (OOO till 08-26) 2014/12/20 03:01:05 Done.
487 return BrowserMainLoop::GetInstance()->memory_pressure_observer();
488 }
489 #endif
490
483 // static 491 // static
484 bool BrowserThread::GetCurrentThreadIdentifier(ID* identifier) { 492 bool BrowserThread::GetCurrentThreadIdentifier(ID* identifier) {
485 if (g_globals == NULL) 493 if (g_globals == NULL)
486 return false; 494 return false;
487 495
488 // We shouldn't use MessageLoop::current() since it uses LazyInstance which 496 // We shouldn't use MessageLoop::current() since it uses LazyInstance which
489 // may be deleted by ~AtExitManager when a WorkerPool thread calls this 497 // may be deleted by ~AtExitManager when a WorkerPool thread calls this
490 // function. 498 // function.
491 // http://crbug.com/63678 499 // http://crbug.com/63678
492 base::ThreadRestrictions::ScopedAllowSingleton allow_singleton; 500 base::ThreadRestrictions::ScopedAllowSingleton allow_singleton;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 AtomicWord* storage = reinterpret_cast<AtomicWord*>( 538 AtomicWord* storage = reinterpret_cast<AtomicWord*>(
531 &globals.thread_delegates[identifier]); 539 &globals.thread_delegates[identifier]);
532 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( 540 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange(
533 storage, reinterpret_cast<AtomicWord>(delegate)); 541 storage, reinterpret_cast<AtomicWord>(delegate));
534 542
535 // This catches registration when previously registered. 543 // This catches registration when previously registered.
536 DCHECK(!delegate || !old_pointer); 544 DCHECK(!delegate || !old_pointer);
537 } 545 }
538 546
539 } // namespace content 547 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698