| OLD | NEW | 
|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef CHROME_PROFILING_PROFILING_GLOBALS_H_ | 5 #ifndef CHROME_PROFILING_PROFILING_GLOBALS_H_ | 
| 6 #define CHROME_PROFILING_PROFILING_GLOBALS_H_ | 6 #define CHROME_PROFILING_PROFILING_GLOBALS_H_ | 
| 7 | 7 | 
| 8 #include <memory> | 8 #include <memory> | 
| 9 | 9 | 
| 10 #include "base/macros.h" | 10 #include "base/macros.h" | 
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" | 
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" | 
|  | 13 #include "chrome/profiling/backtrace_storage.h" | 
|  | 14 #include "chrome/profiling/memlog_connection_manager.h" | 
| 13 | 15 | 
| 14 namespace base { | 16 namespace base { | 
| 15 class MessageLoopForUI; | 17 class MessageLoopForUI; | 
| 16 class SingleThreadTaskRunner; | 18 class SingleThreadTaskRunner; | 
| 17 class TaskRunner; | 19 class TaskRunner; | 
| 18 }  // namespace base | 20 }  // namespace base | 
| 19 | 21 | 
| 20 namespace profiling { | 22 namespace profiling { | 
| 21 | 23 | 
| 22 class ProfilingGlobals { | 24 class ProfilingGlobals { | 
| 23  public: | 25  public: | 
| 24   static ProfilingGlobals* Get(); | 26   static ProfilingGlobals* Get(); | 
| 25 | 27 | 
| 26   base::TaskRunner* GetIORunner(); | 28   base::TaskRunner* GetIORunner(); | 
|  | 29   MemlogConnectionManager* GetMemlogConnectionManager(); | 
|  | 30   BacktraceStorage* GetBacktraceStorage(); | 
| 27 | 31 | 
| 28   // Returns non-null when inside RunMainMessageLoop. Call only on the | 32   // Returns non-null when inside RunMainMessageLoop. Call only on the | 
| 29   // main thread (otherwise there's a shutdown race). | 33   // main thread (otherwise there's a shutdown race). | 
| 30   scoped_refptr<base::SingleThreadTaskRunner> GetMainThread() const; | 34   scoped_refptr<base::SingleThreadTaskRunner> GetMainThread() const; | 
| 31 | 35 | 
| 32   void RunMainMessageLoop(); | 36   void RunMainMessageLoop(); | 
| 33   void QuitWhenIdle(); | 37   void QuitWhenIdle(); | 
| 34 | 38 | 
| 35  private: | 39  private: | 
| 36   ProfilingGlobals(); | 40   ProfilingGlobals(); | 
| 37   ~ProfilingGlobals(); | 41   ~ProfilingGlobals(); | 
| 38 | 42 | 
| 39   // Non-null inside RunMainMessageLoop. | 43   // Non-null inside RunMainMessageLoop. | 
| 40   base::MessageLoopForUI* main_message_loop_ = nullptr; | 44   base::MessageLoopForUI* main_message_loop_ = nullptr; | 
| 41 | 45 | 
| 42   base::Thread io_thread_; | 46   base::Thread io_thread_; | 
|  | 47   MemlogConnectionManager memlog_connection_manager_; | 
|  | 48   BacktraceStorage backtrace_storage_; | 
| 43 | 49 | 
| 44   DISALLOW_COPY_AND_ASSIGN(ProfilingGlobals); | 50   DISALLOW_COPY_AND_ASSIGN(ProfilingGlobals); | 
| 45 }; | 51 }; | 
| 46 | 52 | 
| 47 }  // namespace profiling | 53 }  // namespace profiling | 
| 48 | 54 | 
| 49 #endif  // CHROME_PROFILING_PROFILING_GLOBALS_H_ | 55 #endif  // CHROME_PROFILING_PROFILING_GLOBALS_H_ | 
| OLD | NEW | 
|---|