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

Side by Side Diff: Source/core/html/forms/FormController.h

Issue 277753003: Oilpan: Prepare to move FormController and DocumentState to Oilpan heap, and remove RefPtrs to HTML… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/html/HTMLFormElement.cpp ('k') | Source/core/html/forms/FormController.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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 * 19 *
20 */ 20 */
21 21
22 #ifndef FormController_h 22 #ifndef FormController_h
23 #define FormController_h 23 #define FormController_h
24 24
25 #include "core/html/forms/RadioButtonGroupScope.h" 25 #include "core/html/forms/RadioButtonGroupScope.h"
26 #include "platform/heap/Handle.h"
26 #include "wtf/Forward.h" 27 #include "wtf/Forward.h"
27 #include "wtf/ListHashSet.h" 28 #include "wtf/ListHashSet.h"
28 #include "wtf/Vector.h" 29 #include "wtf/Vector.h"
29 #include "wtf/text/AtomicStringHash.h" 30 #include "wtf/text/AtomicStringHash.h"
30 31
31 namespace WebCore { 32 namespace WebCore {
32 33
33 class FormAssociatedElement; 34 class FormAssociatedElement;
34 class FormKeyGenerator; 35 class FormKeyGenerator;
35 class HTMLFormControlElementWithState; 36 class HTMLFormControlElementWithState;
(...skipping 30 matching lines...) Expand all
66 } 67 }
67 68
68 inline void FormControlState::append(const String& value) 69 inline void FormControlState::append(const String& value)
69 { 70 {
70 m_type = TypeRestore; 71 m_type = TypeRestore;
71 m_values.append(value); 72 m_values.append(value);
72 } 73 }
73 74
74 typedef HashMap<AtomicString, OwnPtr<SavedFormState> > SavedFormStateMap; 75 typedef HashMap<AtomicString, OwnPtr<SavedFormState> > SavedFormStateMap;
75 76
76 class DocumentState : public RefCounted<DocumentState> { 77 class DocumentState : public RefCountedWillBeGarbageCollectedFinalized<DocumentS tate> {
Mads Ager (chromium) 2014/05/09 05:40:08 Looks like this one does not need finalization and
tkent 2014/05/09 06:07:23 I tried it, but blink_gc_plugin warned that HeapHa
zerny-chromium 2014/05/09 06:41:19 Yes. The ListHashSet currently has a user declared
77 public: 78 public:
78 static PassRefPtr<DocumentState> create(); 79 static PassRefPtrWillBeRawPtr<DocumentState> create();
79 ~DocumentState(); 80 ~DocumentState();
81 void trace(Visitor*);
80 82
81 void addControl(HTMLFormControlElementWithState*); 83 void addControl(HTMLFormControlElementWithState*);
82 void removeControl(HTMLFormControlElementWithState*); 84 void removeControl(HTMLFormControlElementWithState*);
83 Vector<String> toStateVector(); 85 Vector<String> toStateVector();
84 86
85 private: 87 private:
86 typedef ListHashSet<RefPtr<HTMLFormControlElementWithState>, 64> FormElement ListHashSet; 88 typedef WillBeHeapListHashSet<RefPtrWillBeMember<HTMLFormControlElementWithS tate>, 64> FormElementListHashSet;
87 FormElementListHashSet m_formControls; 89 FormElementListHashSet m_formControls;
88 }; 90 };
89 91
90 class FormController { 92 class FormController : public NoBaseWillBeGarbageCollectedFinalized<FormControll er> {
91 WTF_MAKE_FAST_ALLOCATED; 93 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
92 public: 94 public:
93 static PassOwnPtr<FormController> create() 95 static PassOwnPtrWillBeRawPtr<FormController> create()
94 { 96 {
95 return adoptPtr(new FormController); 97 return adoptPtrWillBeNoop(new FormController);
96 } 98 }
97 ~FormController(); 99 ~FormController();
100 void trace(Visitor*);
98 101
99 RadioButtonGroupScope& radioButtonGroupScope() { return m_radioButtonGroupSc ope; } 102 RadioButtonGroupScope& radioButtonGroupScope() { return m_radioButtonGroupSc ope; }
100 103
101 void registerStatefulFormControl(HTMLFormControlElementWithState&); 104 void registerStatefulFormControl(HTMLFormControlElementWithState&);
102 void unregisterStatefulFormControl(HTMLFormControlElementWithState&); 105 void unregisterStatefulFormControl(HTMLFormControlElementWithState&);
103 // This should be callled only by Document::formElementsState(). 106 // This should be callled only by Document::formElementsState().
104 DocumentState* formElementsState() const; 107 DocumentState* formElementsState() const;
105 // This should be callled only by Document::setStateForNewFormElements(). 108 // This should be callled only by Document::setStateForNewFormElements().
106 void setStateForNewFormElements(const Vector<String>&); 109 void setStateForNewFormElements(const Vector<String>&);
107 void willDeleteForm(HTMLFormElement*); 110 void willDeleteForm(HTMLFormElement*);
108 void restoreControlStateFor(HTMLFormControlElementWithState&); 111 void restoreControlStateFor(HTMLFormControlElementWithState&);
109 void restoreControlStateIn(HTMLFormElement&); 112 void restoreControlStateIn(HTMLFormElement&);
110 113
111 static Vector<String> getReferencedFilePaths(const Vector<String>& stateVect or); 114 static Vector<String> getReferencedFilePaths(const Vector<String>& stateVect or);
112 115
113 private: 116 private:
114 FormController(); 117 FormController();
115 FormControlState takeStateForFormElement(const HTMLFormControlElementWithSta te&); 118 FormControlState takeStateForFormElement(const HTMLFormControlElementWithSta te&);
116 static void formStatesFromStateVector(const Vector<String>&, SavedFormStateM ap&); 119 static void formStatesFromStateVector(const Vector<String>&, SavedFormStateM ap&);
117 120
118 RadioButtonGroupScope m_radioButtonGroupScope; 121 RadioButtonGroupScope m_radioButtonGroupScope;
119 RefPtr<DocumentState> m_documentState; 122 RefPtrWillBeMember<DocumentState> m_documentState;
120 SavedFormStateMap m_savedFormStateMap; 123 SavedFormStateMap m_savedFormStateMap;
121 OwnPtr<FormKeyGenerator> m_formKeyGenerator; 124 OwnPtr<FormKeyGenerator> m_formKeyGenerator;
122 }; 125 };
123 126
124 } // namespace WebCore 127 } // namespace WebCore
125 #endif 128 #endif
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFormElement.cpp ('k') | Source/core/html/forms/FormController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698