summaryrefslogtreecommitdiffstats
path: root/content/common
diff options
context:
space:
mode:
authorjam <jam@chromium.org>2016-02-10 15:45:40 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-10 23:47:16 +0000
commitffaec53850a27fc0888998c98c7bb092ccbd8552 (patch)
tree665d5d9564497e52b6343f33eb9e6ef2636203d0 /content/common
parentac440714860679857517ac7dd4c6282acbfa4033 (diff)
downloadchromium_src-ffaec53850a27fc0888998c98c7bb092ccbd8552.zip
chromium_src-ffaec53850a27fc0888998c98c7bb092ccbd8552.tar.gz
chromium_src-ffaec53850a27fc0888998c98c7bb092ccbd8552.tar.bz2
Add comments for struct members that were changed from size_t to uin32_t or uint64_t for IPC safety.
Also add a few checked_cast for places where we converted from size_t and we're sure that it's safe. BUG=581409 Review URL: https://codereview.chromium.org/1684793003 Cr-Commit-Position: refs/heads/master@{#374788}
Diffstat (limited to 'content/common')
-rw-r--r--content/common/gpu/gpu_memory_manager.cc2
-rw-r--r--content/common/gpu/gpu_memory_uma_stats.h6
2 files changed, 5 insertions, 3 deletions
diff --git a/content/common/gpu/gpu_memory_manager.cc b/content/common/gpu/gpu_memory_manager.cc
index 4b9eb7c..10f769c 100644
--- a/content/common/gpu/gpu_memory_manager.cc
+++ b/content/common/gpu/gpu_memory_manager.cc
@@ -118,7 +118,7 @@ void GpuMemoryManager::SendUmaStatsToBrowser() {
GPUMemoryUmaStats params;
params.bytes_allocated_current = GetCurrentUsage();
params.bytes_allocated_max = bytes_allocated_historical_max_;
- params.context_group_count = tracking_groups_.size();
+ params.context_group_count = static_cast<uint32_t>(tracking_groups_.size());
channel_manager_->Send(new GpuHostMsg_GpuMemoryUmaStats(params));
}
} // namespace content
diff --git a/content/common/gpu/gpu_memory_uma_stats.h b/content/common/gpu/gpu_memory_uma_stats.h
index 16c8813..daf91bf 100644
--- a/content/common/gpu/gpu_memory_uma_stats.h
+++ b/content/common/gpu/gpu_memory_uma_stats.h
@@ -11,6 +11,8 @@ namespace content {
// Memory usage statistics send periodically to the browser process to report
// in UMA histograms if the GPU process crashes.
+// Note: we use uint64_t instead of size_t for byte count because this struct
+// is sent over IPC which could span 32 & 64 bit processes.
struct GPUMemoryUmaStats {
GPUMemoryUmaStats()
: bytes_allocated_current(0),
@@ -19,10 +21,10 @@ struct GPUMemoryUmaStats {
}
// The number of bytes currently allocated.
- uint32_t bytes_allocated_current;
+ uint64_t bytes_allocated_current;
// The maximum number of bytes ever allocated at once.
- uint32_t bytes_allocated_max;
+ uint64_t bytes_allocated_max;
// The number of context groups.
uint32_t context_group_count;