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

Side by Side Diff: chrome/browser/task_management/sampling/task_manager_io_thread_helper.h

Issue 1918423002: Fix TaskmanagerIoThreadHelper bug. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/task_management/sampling/task_manager_io_thread_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_MANAGEMENT_SAMPLING_TASK_MANAGER_IO_THREAD_HELPER_H_ 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IO_THREAD_HELPER_H_
6 #define CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IO_THREAD_HELPER_H_ 6 #define CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IO_THREAD_HELPER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h"
13 14
14 namespace net { 15 namespace net {
15 class URLRequest; 16 class URLRequest;
16 } // namespace net 17 } // namespace net
17 18
18 namespace task_management { 19 namespace task_management {
19 20
20 // Defines a wrapper of values that will be sent from IO to UI thread upon 21 // Defines a wrapper of values that will be sent from IO to UI thread upon
21 // reception of bytes read notifications. 22 // reception of bytes read notifications.
22 struct BytesReadParam { 23 struct BytesReadParam {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // TaskManagerInterface if the new task manager is enabled. 72 // TaskManagerInterface if the new task manager is enabled.
72 static void OnRawBytesRead(const net::URLRequest& request, 73 static void OnRawBytesRead(const net::URLRequest& request,
73 int64_t bytes_read); 74 int64_t bytes_read);
74 75
75 private: 76 private:
76 TaskManagerIoThreadHelper(); 77 TaskManagerIoThreadHelper();
77 ~TaskManagerIoThreadHelper(); 78 ~TaskManagerIoThreadHelper();
78 79
79 // We gather multiple notifications on the IO thread in one second before a 80 // We gather multiple notifications on the IO thread in one second before a
80 // call is made to the following function to start the processing. 81 // call is made to the following function to start the processing.
81 static void OnMultipleBytesReadIO(); 82 void OnMultipleBytesReadIO();
82 83
83 // This will update the task manager with the network bytes read. 84 // This will update the task manager with the network bytes read.
84 void OnNetworkBytesRead(const net::URLRequest& request, int64_t bytes_read); 85 void OnNetworkBytesRead(const net::URLRequest& request, int64_t bytes_read);
85 86
86 // This buffer will be filled on IO thread with information about the number 87 // This buffer will be filled on IO thread with information about the number
87 // of bytes read from URLRequests. 88 // of bytes read from URLRequests.
88 std::vector<BytesReadParam> bytes_read_buffer_; 89 std::vector<BytesReadParam> bytes_read_buffer_;
89 90
91 base::WeakPtrFactory<TaskManagerIoThreadHelper> weak_factory_;
92
90 DISALLOW_COPY_AND_ASSIGN(TaskManagerIoThreadHelper); 93 DISALLOW_COPY_AND_ASSIGN(TaskManagerIoThreadHelper);
91 }; 94 };
92 95
93 } // namespace task_management 96 } // namespace task_management
94 97
95 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IO_THREAD_HELPER _H_ 98 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IO_THREAD_HELPER _H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/task_management/sampling/task_manager_io_thread_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698