Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(477)

Side by Side Diff: third_party/WebKit/Source/platform/PurgeableVector.cpp

Issue 1460523004: Avoid unnecessary wtf/text/WTFString.h includes in platform/heap/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "platform/PurgeableVector.h" 32 #include "platform/PurgeableVector.h"
33 33
34 #include "public/platform/Platform.h" 34 #include "public/platform/Platform.h"
35 #include "public/platform/WebDiscardableMemory.h" 35 #include "public/platform/WebDiscardableMemory.h"
36 #include "public/platform/WebProcessMemoryDump.h" 36 #include "public/platform/WebProcessMemoryDump.h"
37 #include "wtf/Assertions.h" 37 #include "wtf/Assertions.h"
38 #include "wtf/OwnPtr.h" 38 #include "wtf/OwnPtr.h"
39 #include "wtf/PassOwnPtr.h" 39 #include "wtf/PassOwnPtr.h"
40 #include "wtf/text/WTFString.h"
40 41
41 #include <cstring> 42 #include <cstring>
42 43
43 namespace blink { 44 namespace blink {
44 45
45 // WebDiscardableMemory allocations are expensive and page-grained. We only use 46 // WebDiscardableMemory allocations are expensive and page-grained. We only use
46 // them when there's a reasonable amount of memory to be saved by the OS 47 // them when there's a reasonable amount of memory to be saved by the OS
47 // discarding the memory. 48 // discarding the memory.
48 static const size_t minimumDiscardableAllocationSize = 4 * 4096; 49 static const size_t minimumDiscardableAllocationSize = 4 * 4096;
49 50
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // fragmentation. 268 // fragmentation.
268 // Since the page size is only used below to minimize fragmentation it's sti ll safe to use it 269 // Since the page size is only used below to minimize fragmentation it's sti ll safe to use it
269 // even if it gets out of sync (e.g. due to the use of huge pages). 270 // even if it gets out of sync (e.g. due to the use of huge pages).
270 const size_t kPageSize = 4096; 271 const size_t kPageSize = 4096;
271 newCapacity = (newCapacity + kPageSize - 1) & ~(kPageSize - 1); 272 newCapacity = (newCapacity + kPageSize - 1) & ~(kPageSize - 1);
272 273
273 return std::max(capacity, newCapacity); // Overflow check. 274 return std::max(capacity, newCapacity); // Overflow check.
274 } 275 }
275 276
276 } // namespace blink 277 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698