| OLD | NEW |
| 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 #include "components/tracing/graphics_memory_dump_provider_android.h" | 5 #include "components/tracing/graphics_memory_dump_provider_android.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // static | 32 // static |
| 33 GraphicsMemoryDumpProvider* GraphicsMemoryDumpProvider::GetInstance() { | 33 GraphicsMemoryDumpProvider* GraphicsMemoryDumpProvider::GetInstance() { |
| 34 return base::Singleton< | 34 return base::Singleton< |
| 35 GraphicsMemoryDumpProvider, | 35 GraphicsMemoryDumpProvider, |
| 36 base::LeakySingletonTraits<GraphicsMemoryDumpProvider>>::get(); | 36 base::LeakySingletonTraits<GraphicsMemoryDumpProvider>>::get(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool GraphicsMemoryDumpProvider::OnMemoryDump( | 39 bool GraphicsMemoryDumpProvider::OnMemoryDump( |
| 40 const base::trace_event::MemoryDumpArgs& args, | 40 const base::trace_event::MemoryDumpArgs& args, |
| 41 base::trace_event::ProcessMemoryDump* pmd) { | 41 base::trace_event::ProcessMemoryDump* pmd) { |
| 42 if (args.level_of_detail != |
| 43 base::trace_event::MemoryDumpLevelOfDetail::DETAILED) |
| 44 return true; // Dump on detailed memory dumps only. |
| 45 |
| 42 const char kAbstractSocketName[] = "chrome_tracing_memtrack_helper"; | 46 const char kAbstractSocketName[] = "chrome_tracing_memtrack_helper"; |
| 43 struct sockaddr_un addr; | 47 struct sockaddr_un addr; |
| 44 | 48 |
| 45 const int sock = socket(AF_UNIX, SOCK_SEQPACKET, 0); | 49 const int sock = socket(AF_UNIX, SOCK_SEQPACKET, 0); |
| 46 if (sock == -1) | 50 if (sock == -1) |
| 47 return false; | 51 return false; |
| 48 // Ensures that sock is always closed, even in case of early returns. | 52 // Ensures that sock is always closed, even in case of early returns. |
| 49 base::ScopedFD sock_closer(sock); | 53 base::ScopedFD sock_closer(sock); |
| 50 | 54 |
| 51 // Set recv() timeout to 250 ms. | 55 // Set recv() timeout to 250 ms. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 mad->AddScalar(long_lived_column_name->c_str(), | 138 mad->AddScalar(long_lived_column_name->c_str(), |
| 135 MemoryAllocatorDump::kUnitsBytes, value); | 139 MemoryAllocatorDump::kUnitsBytes, value); |
| 136 } | 140 } |
| 137 } | 141 } |
| 138 | 142 |
| 139 GraphicsMemoryDumpProvider::GraphicsMemoryDumpProvider() {} | 143 GraphicsMemoryDumpProvider::GraphicsMemoryDumpProvider() {} |
| 140 | 144 |
| 141 GraphicsMemoryDumpProvider::~GraphicsMemoryDumpProvider() {} | 145 GraphicsMemoryDumpProvider::~GraphicsMemoryDumpProvider() {} |
| 142 | 146 |
| 143 } // namespace tracing | 147 } // namespace tracing |
| OLD | NEW |