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