OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <algorithm> | 10 #include <algorithm> |
8 #include <limits> | 11 #include <limits> |
9 | 12 |
10 #include "base/atomic_sequence_num.h" | 13 #include "base/atomic_sequence_num.h" |
11 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 15 #include "base/macros.h" |
12 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
13 #include "base/numerics/safe_math.h" | 17 #include "base/numerics/safe_math.h" |
14 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
15 #include "base/strings/string_split.h" | 19 #include "base/strings/string_split.h" |
16 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
17 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
18 #include "base/thread_task_runner_handle.h" | 22 #include "base/thread_task_runner_handle.h" |
19 #include "base/trace_event/memory_dump_manager.h" | 23 #include "base/trace_event/memory_dump_manager.h" |
20 #include "base/trace_event/trace_event.h" | 24 #include "base/trace_event/trace_event.h" |
21 #include "cc/resources/platform_color.h" | 25 #include "cc/resources/platform_color.h" |
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 worker_context ? output_surface_->worker_context_provider() | 1620 worker_context ? output_surface_->worker_context_provider() |
1617 : output_surface_->context_provider(); | 1621 : output_surface_->context_provider(); |
1618 return context_provider ? context_provider->GrContext() : NULL; | 1622 return context_provider ? context_provider->GrContext() : NULL; |
1619 } | 1623 } |
1620 | 1624 |
1621 bool ResourceProvider::OnMemoryDump( | 1625 bool ResourceProvider::OnMemoryDump( |
1622 const base::trace_event::MemoryDumpArgs& args, | 1626 const base::trace_event::MemoryDumpArgs& args, |
1623 base::trace_event::ProcessMemoryDump* pmd) { | 1627 base::trace_event::ProcessMemoryDump* pmd) { |
1624 DCHECK(thread_checker_.CalledOnValidThread()); | 1628 DCHECK(thread_checker_.CalledOnValidThread()); |
1625 | 1629 |
1626 const uint64 tracing_process_id = | 1630 const uint64_t tracing_process_id = |
1627 base::trace_event::MemoryDumpManager::GetInstance() | 1631 base::trace_event::MemoryDumpManager::GetInstance() |
1628 ->GetTracingProcessId(); | 1632 ->GetTracingProcessId(); |
1629 | 1633 |
1630 for (const auto& resource_entry : resources_) { | 1634 for (const auto& resource_entry : resources_) { |
1631 const auto& resource = resource_entry.second; | 1635 const auto& resource = resource_entry.second; |
1632 | 1636 |
1633 // Resource IDs are not process-unique, so log with the ResourceProvider's | 1637 // Resource IDs are not process-unique, so log with the ResourceProvider's |
1634 // unique id. | 1638 // unique id. |
1635 std::string dump_name = | 1639 std::string dump_name = |
1636 base::StringPrintf("cc/resource_memory/provider_%d/resource_%d", | 1640 base::StringPrintf("cc/resource_memory/provider_%d/resource_%d", |
(...skipping 28 matching lines...) Expand all Loading... |
1665 const int kImportance = 2; | 1669 const int kImportance = 2; |
1666 pmd->CreateSharedGlobalAllocatorDump(guid); | 1670 pmd->CreateSharedGlobalAllocatorDump(guid); |
1667 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 1671 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
1668 } | 1672 } |
1669 } | 1673 } |
1670 | 1674 |
1671 return true; | 1675 return true; |
1672 } | 1676 } |
1673 | 1677 |
1674 } // namespace cc | 1678 } // namespace cc |
OLD | NEW |