Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CONTENT_BROWSER_PROFILER_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_PROFILER_MESSAGE_FILTER_H_ |
| 6 #define CONTENT_BROWSER_PROFILER_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_PROFILER_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/metrics/call_stack_profile_params.h" | |
| 11 #include "base/profiler/stack_sampling_profiler.h" | |
|
erikchen
2015/08/31 21:17:28
Should we forward declare the types we need and ad
sydli
2015/09/01 00:29:59
Done. Couldn't forward declare CallStackProfiles,
| |
| 10 #include "content/public/browser/browser_message_filter.h" | 12 #include "content/public/browser/browser_message_filter.h" |
| 11 #include "content/public/common/process_type.h" | 13 #include "content/public/common/process_type.h" |
| 12 | 14 |
| 13 namespace tracked_objects { | 15 namespace tracked_objects { |
| 14 struct ProcessDataSnapshot; | 16 struct ProcessDataSnapshot; |
| 15 } | 17 } |
| 16 | 18 |
| 17 namespace content { | 19 namespace content { |
| 18 | 20 |
| 19 // This class sends and receives profiler messages in the browser process. | 21 // This class sends and receives profiler messages in the browser process. |
| 20 class ProfilerMessageFilter : public BrowserMessageFilter { | 22 class ProfilerMessageFilter : public BrowserMessageFilter { |
| 21 public: | 23 public: |
| 22 explicit ProfilerMessageFilter(content::ProcessType process_type); | 24 explicit ProfilerMessageFilter(content::ProcessType process_type); |
| 23 | 25 |
| 24 // BrowserMessageFilter implementation. | 26 // BrowserMessageFilter implementation. |
| 25 void OnChannelConnected(int32 peer_pid) override; | 27 void OnChannelConnected(int32 peer_pid) override; |
| 26 | 28 |
| 27 // BrowserMessageFilter implementation. | 29 // BrowserMessageFilter implementation. |
| 28 bool OnMessageReceived(const IPC::Message& message) override; | 30 bool OnMessageReceived(const IPC::Message& message) override; |
| 29 | 31 |
| 30 protected: | 32 protected: |
| 31 ~ProfilerMessageFilter() override; | 33 ~ProfilerMessageFilter() override; |
| 32 | 34 |
| 33 private: | 35 private: |
| 34 // Message handlers. | 36 // Message handlers. |
| 35 void OnChildProfilerData( | 37 void OnChildProfilerData( |
| 36 int sequence_number, | 38 int sequence_number, |
| 37 const tracked_objects::ProcessDataSnapshot& profiler_data); | 39 const tracked_objects::ProcessDataSnapshot& profiler_data); |
| 38 | 40 |
| 41 // Handler for stack sampler data profiled on child thread. | |
| 42 void OnChildStackProfilerData( | |
| 43 const base::StackSamplingProfiler::CallStackProfiles& profiler_data, | |
| 44 const base::CallStackProfileParams& params, | |
| 45 base::TimeTicks start_timestamp); | |
| 46 | |
| 39 #if defined(USE_TCMALLOC) | 47 #if defined(USE_TCMALLOC) |
| 40 void OnTcmallocStats(const std::string& output); | 48 void OnTcmallocStats(const std::string& output); |
| 41 #endif | 49 #endif |
| 42 | 50 |
| 43 content::ProcessType process_type_; | 51 content::ProcessType process_type_; |
| 44 | 52 |
| 45 DISALLOW_COPY_AND_ASSIGN(ProfilerMessageFilter); | 53 DISALLOW_COPY_AND_ASSIGN(ProfilerMessageFilter); |
| 46 }; | 54 }; |
| 47 | 55 |
| 48 } // namespace content | 56 } // namespace content |
| 49 | 57 |
| 50 #endif // CONTENT_BROWSER_PROFILER_MESSAGE_FILTER_H_ | 58 #endif // CONTENT_BROWSER_PROFILER_MESSAGE_FILTER_H_ |
| OLD | NEW |