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

Side by Side Diff: chrome/browser/task_manager/sampling/shared_sampler.h

Issue 2657393003: Add unit-test for SharedSampler handling of zero-thread processes. (Closed)
Patch Set: Remove anonymous namespace Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_BROWSER_TASK_MANAGER_SAMPLING_SHARED_SAMPLER_H_ 5 #ifndef CHROME_BROWSER_TASK_MANAGER_SAMPLING_SHARED_SAMPLER_H_
6 #define CHROME_BROWSER_TASK_MANAGER_SAMPLING_SHARED_SAMPLER_H_ 6 #define CHROME_BROWSER_TASK_MANAGER_SAMPLING_SHARED_SAMPLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 const OnStartTimeCallback& on_start_time, 55 const OnStartTimeCallback& on_start_time,
56 const OnCpuTimeCallback& on_cpu_time); 56 const OnCpuTimeCallback& on_cpu_time);
57 57
58 // Unregisters task group specific callbacks. 58 // Unregisters task group specific callbacks.
59 void UnregisterCallbacks(base::ProcessId process_id); 59 void UnregisterCallbacks(base::ProcessId process_id);
60 60
61 // Refreshes the expensive process' stats (for now only idle wakeups per 61 // Refreshes the expensive process' stats (for now only idle wakeups per
62 // second) on the worker thread. 62 // second) on the worker thread.
63 void Refresh(base::ProcessId process_id, int64_t refresh_flags); 63 void Refresh(base::ProcessId process_id, int64_t refresh_flags);
64 64
65 #if defined(OS_WIN)
66 // Specifies a function to use in place of NtQuerySystemInformation.
67 typedef int (*QuerySystemInformationForTest)(unsigned char* buffer,
68 int buffer_size);
69 static void SetQuerySystemInformationForTest(
70 QuerySystemInformationForTest query_system_information);
71 #endif // defined(OS_WIN)
72
65 private: 73 private:
66 friend class base::RefCountedThreadSafe<SharedSampler>; 74 friend class base::RefCountedThreadSafe<SharedSampler>;
67 ~SharedSampler(); 75 ~SharedSampler();
68 76
69 #if defined(OS_WIN) 77 #if defined(OS_WIN)
70 // The UI-thread callbacks in TaskGroup registered with RegisterCallbacks and 78 // The UI-thread callbacks in TaskGroup registered with RegisterCallbacks and
71 // to be called when refresh on the worker thread is done. 79 // to be called when refresh on the worker thread is done.
72 struct Callbacks { 80 struct Callbacks {
73 Callbacks(); 81 Callbacks();
74 Callbacks(Callbacks&& other); 82 Callbacks(Callbacks&& other);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // To assert we're running on the correct thread. 156 // To assert we're running on the correct thread.
149 base::SequenceChecker worker_pool_sequenced_checker_; 157 base::SequenceChecker worker_pool_sequenced_checker_;
150 #endif // defined(OS_WIN) 158 #endif // defined(OS_WIN)
151 159
152 DISALLOW_COPY_AND_ASSIGN(SharedSampler); 160 DISALLOW_COPY_AND_ASSIGN(SharedSampler);
153 }; 161 };
154 162
155 } // namespace task_manager 163 } // namespace task_manager
156 164
157 #endif // CHROME_BROWSER_TASK_MANAGER_SAMPLING_SHARED_SAMPLER_H_ 165 #endif // CHROME_BROWSER_TASK_MANAGER_SAMPLING_SHARED_SAMPLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/task_manager/sampling/shared_sampler_unittest_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698