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

Side by Side Diff: third_party/WebKit/Source/platform/heap/CallbackStack.h

Issue 1750553002: Reduce weak callback stack reservation for non-main threads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: whitespace Created 4 years, 9 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CallbackStack_h 5 #ifndef CallbackStack_h
6 #define CallbackStack_h 6 #define CallbackStack_h
7 7
8 #include "platform/heap/BlinkGC.h" 8 #include "platform/heap/BlinkGC.h"
9 #include "wtf/Allocator.h" 9 #include "wtf/Allocator.h"
10 #include "wtf/Assertions.h" 10 #include "wtf/Assertions.h"
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 void* object() { return m_object; } 31 void* object() { return m_object; }
32 VisitorCallback callback() { return m_callback; } 32 VisitorCallback callback() { return m_callback; }
33 void call(Visitor* visitor) { m_callback(visitor, m_object); } 33 void call(Visitor* visitor) { m_callback(visitor, m_object); }
34 34
35 private: 35 private:
36 void* m_object; 36 void* m_object;
37 VisitorCallback m_callback; 37 VisitorCallback m_callback;
38 }; 38 };
39 39
40 explicit CallbackStack(size_t blockSize = defaultBlockSize); 40 explicit CallbackStack(size_t blockSize = kDefaultBlockSize);
41 ~CallbackStack(); 41 ~CallbackStack();
42 42
43 void clear(); 43 void clear();
44 void decommit(); 44 void decommit();
45 45
46 Item* allocateEntry(); 46 Item* allocateEntry();
47 Item* pop(); 47 Item* pop();
48 48
49 bool isEmpty() const; 49 bool isEmpty() const;
50 50
51 void invokeEphemeronCallbacks(Visitor*); 51 void invokeEphemeronCallbacks(Visitor*);
52 52
53 #if ENABLE(ASSERT) 53 #if ENABLE(ASSERT)
54 bool hasCallbackForObject(const void*); 54 bool hasCallbackForObject(const void*);
55 #endif 55 #endif
56 56
57 static const size_t kMinimalBlockSize; 57 static const size_t kMinimalBlockSize;
58 static const size_t kDefaultBlockSize = (1 << 13);
58 59
59 private: 60 private:
60 static const size_t defaultBlockSize = (1 << 13);
61
62 class Block { 61 class Block {
63 USING_FAST_MALLOC(Block); 62 USING_FAST_MALLOC(Block);
64 public: 63 public:
65 Block(Block* next, size_t blockSize); 64 Block(Block* next, size_t blockSize);
66 ~Block(); 65 ~Block();
67 66
68 #if ENABLE(ASSERT) 67 #if ENABLE(ASSERT)
69 void clear(); 68 void clear();
70 #endif 69 #endif
71 void decommit(); 70 void decommit();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 Item* item = m_first->pop(); 131 Item* item = m_first->pop();
133 if (LIKELY(!!item)) 132 if (LIKELY(!!item))
134 return item; 133 return item;
135 134
136 return popSlow(); 135 return popSlow();
137 } 136 }
138 137
139 } // namespace blink 138 } // namespace blink
140 139
141 #endif // CallbackStack_h 140 #endif // CallbackStack_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698