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

Side by Side Diff: Source/core/rendering/RenderArena.h

Issue 16695002: Uptake WebKit Changeset r149185. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Refetch render view and null check AXObjectCache Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/page/FrameView.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Apple Computer, Inc. 2 * Copyright (C) 2003 Apple Computer, Inc.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public 7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version. 9 * version 2.1 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 18 matching lines...) Expand all
29 * deletingthe provisions above and replace them with the notice and 29 * deletingthe provisions above and replace them with the notice and
30 * other provisions required by the MPL or the GPL, as the case may be. 30 * other provisions required by the MPL or the GPL, as the case may be.
31 * If you do not delete the provisions above, a recipient may use your 31 * If you do not delete the provisions above, a recipient may use your
32 * version of this file under any of the LGPL, the MPL or the GPL. 32 * version of this file under any of the LGPL, the MPL or the GPL.
33 */ 33 */
34 34
35 #ifndef RenderArena_h 35 #ifndef RenderArena_h
36 #define RenderArena_h 36 #define RenderArena_h
37 37
38 #include "core/platform/Arena.h" 38 #include "core/platform/Arena.h"
39 #include <wtf/FastAllocBase.h> 39 #include "wtf/FastAllocBase.h"
40 #include <wtf/Noncopyable.h> 40 #include "wtf/Noncopyable.h"
41 #include "wtf/PassRefPtr.h"
42 #include "wtf/RefCounted.h"
41 43
42 namespace WebCore { 44 namespace WebCore {
43 45
44 static const size_t gMaxRecycledSize = 1024; 46 static const size_t gMaxRecycledSize = 1024;
45 47
46 class RenderArena { 48 class RenderArena : public RefCounted<RenderArena> {
47 WTF_MAKE_NONCOPYABLE(RenderArena); WTF_MAKE_FAST_ALLOCATED;
48 public: 49 public:
49 explicit RenderArena(unsigned arenaSize = 8192); 50 static PassRefPtr<RenderArena> create() { return adoptRef(new RenderArena); }
50 ~RenderArena(); 51 ~RenderArena();
51 52
52 // Memory management functions 53 // Memory management functions
53 void* allocate(size_t); 54 void* allocate(size_t);
54 void free(size_t, void*); 55 void free(size_t, void*);
55 56
56 size_t totalRenderArenaSize() const { return m_totalSize; } 57 size_t totalRenderArenaSize() const { return m_totalSize; }
57 size_t totalRenderArenaAllocatedBytes() const { return m_totalAllocated; } 58 size_t totalRenderArenaAllocatedBytes() const { return m_totalAllocated; }
58 59
59 private: 60 private:
61 RenderArena(unsigned arenaSize = 8192);
62
60 // Underlying arena pool 63 // Underlying arena pool
61 ArenaPool m_pool; 64 ArenaPool m_pool;
62 65
63 // The mask used to secure the recycled freelist pointers. 66 // The mask used to secure the recycled freelist pointers.
64 uintptr_t m_mask; 67 uintptr_t m_mask;
65 // The recycler array is sparse with the indices being multiples of the 68 // The recycler array is sparse with the indices being multiples of the
66 // rounding size, sizeof(void*), i.e., 0, 4, 8, 12, 16, 20, ... on 32-bit. 69 // rounding size, sizeof(void*), i.e., 0, 4, 8, 12, 16, 20, ... on 32-bit.
67 static const size_t kRecyclerShift = (sizeof(void*) == 8) ? 3 : 2; 70 static const size_t kRecyclerShift = (sizeof(void*) == 8) ? 3 : 2;
68 void* m_recyclers[gMaxRecycledSize >> kRecyclerShift]; 71 void* m_recyclers[gMaxRecycledSize >> kRecyclerShift];
69 72
70 size_t m_totalSize; 73 size_t m_totalSize;
71 size_t m_totalAllocated; 74 size_t m_totalAllocated;
72 }; 75 };
73 76
74 } // namespace WebCore 77 } // namespace WebCore
75 78
76 #endif // RenderArena_h 79 #endif // RenderArena_h
OLDNEW
« no previous file with comments | « Source/core/page/FrameView.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698