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

Side by Side Diff: third_party/WebKit/Source/core/fileapi/FileReader.cpp

Issue 1853743005: Oilpan: Remove WillBe types (part 13) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #endif 64 #endif
65 65
66 } // namespace 66 } // namespace
67 67
68 // Embedders like chromium limit the number of simultaneous requests to avoid 68 // Embedders like chromium limit the number of simultaneous requests to avoid
69 // excessive IPC congestion. We limit this to 100 per thread to throttle the 69 // excessive IPC congestion. We limit this to 100 per thread to throttle the
70 // requests (the value is arbitrarily chosen). 70 // requests (the value is arbitrarily chosen).
71 static const size_t kMaxOutstandingRequestsPerThread = 100; 71 static const size_t kMaxOutstandingRequestsPerThread = 100;
72 static const double progressNotificationIntervalMS = 50; 72 static const double progressNotificationIntervalMS = 50;
73 73
74 class FileReader::ThrottlingController final : public NoBaseWillBeGarbageCollect edFinalized<FileReader::ThrottlingController>, public WillBeHeapSupplement<Execu tionContext> { 74 class FileReader::ThrottlingController final : public GarbageCollectedFinalized< FileReader::ThrottlingController>, public HeapSupplement<ExecutionContext> {
75 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileReader::ThrottlingController); 75 USING_GARBAGE_COLLECTED_MIXIN(FileReader::ThrottlingController);
76 public: 76 public:
77 static ThrottlingController* from(ExecutionContext* context) 77 static ThrottlingController* from(ExecutionContext* context)
78 { 78 {
79 if (!context) 79 if (!context)
80 return 0; 80 return 0;
81 81
82 ThrottlingController* controller = static_cast<ThrottlingController*>(Wi llBeHeapSupplement<ExecutionContext>::from(*context, supplementName())); 82 ThrottlingController* controller = static_cast<ThrottlingController*>(He apSupplement<ExecutionContext>::from(*context, supplementName()));
83 if (!controller) { 83 if (!controller) {
84 controller = new ThrottlingController(); 84 controller = new ThrottlingController();
85 WillBeHeapSupplement<ExecutionContext>::provideTo(*context, suppleme ntName(), adoptPtrWillBeNoop(controller)); 85 HeapSupplement<ExecutionContext>::provideTo(*context, supplementName (), adoptPtrWillBeNoop(controller));
86 } 86 }
87 return controller; 87 return controller;
88 } 88 }
89 89
90 ~ThrottlingController() { } 90 ~ThrottlingController() { }
91 91
92 enum FinishReaderType { DoNotRunPendingReaders, RunPendingReaders }; 92 enum FinishReaderType { DoNotRunPendingReaders, RunPendingReaders };
93 93
94 static void pushReader(ExecutionContext* context, FileReader* reader) 94 static void pushReader(ExecutionContext* context, FileReader* reader)
95 { 95 {
(...skipping 24 matching lines...) Expand all
120 120
121 controller->finishReader(reader, nextStep); 121 controller->finishReader(reader, nextStep);
122 } 122 }
123 123
124 DEFINE_INLINE_TRACE() 124 DEFINE_INLINE_TRACE()
125 { 125 {
126 #if ENABLE(OILPAN) 126 #if ENABLE(OILPAN)
127 visitor->trace(m_pendingReaders); 127 visitor->trace(m_pendingReaders);
128 visitor->trace(m_runningReaders); 128 visitor->trace(m_runningReaders);
129 #endif 129 #endif
130 WillBeHeapSupplement<ExecutionContext>::trace(visitor); 130 HeapSupplement<ExecutionContext>::trace(visitor);
131 } 131 }
132 132
133 private: 133 private:
134 ThrottlingController() 134 ThrottlingController()
135 : m_maxRunningReaders(kMaxOutstandingRequestsPerThread) 135 : m_maxRunningReaders(kMaxOutstandingRequestsPerThread)
136 { 136 {
137 } 137 }
138 138
139 void pushReader(FileReader* reader) 139 void pushReader(FileReader* reader)
140 { 140 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 FileReader* reader = m_pendingReaders.takeFirst(); 180 FileReader* reader = m_pendingReaders.takeFirst();
181 reader->executePendingRead(); 181 reader->executePendingRead();
182 m_runningReaders.add(reader); 182 m_runningReaders.add(reader);
183 } 183 }
184 } 184 }
185 185
186 static const char* supplementName() { return "FileReaderThrottlingController "; } 186 static const char* supplementName() { return "FileReaderThrottlingController "; }
187 187
188 const size_t m_maxRunningReaders; 188 const size_t m_maxRunningReaders;
189 189
190 using FileReaderDeque = PersistentHeapDequeWillBeHeapDeque<Member<FileReader >>; 190 using FileReaderDeque = HeapDeque<Member<FileReader>>;
191 using FileReaderHashSet = PersistentHeapHashSetWillBeHeapHashSet<Member<File Reader>>; 191 using FileReaderHashSet = HeapHashSet<Member<FileReader>>;
192 192
193 FileReaderDeque m_pendingReaders; 193 FileReaderDeque m_pendingReaders;
194 FileReaderHashSet m_runningReaders; 194 FileReaderHashSet m_runningReaders;
195 }; 195 };
196 196
197 FileReader* FileReader::create(ExecutionContext* context) 197 FileReader* FileReader::create(ExecutionContext* context)
198 { 198 {
199 FileReader* fileReader = new FileReader(context); 199 FileReader* fileReader = new FileReader(context);
200 fileReader->suspendIfNeeded(); 200 fileReader->suspendIfNeeded();
201 return fileReader; 201 return fileReader;
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } 469 }
470 470
471 DEFINE_TRACE(FileReader) 471 DEFINE_TRACE(FileReader)
472 { 472 {
473 visitor->trace(m_error); 473 visitor->trace(m_error);
474 RefCountedGarbageCollectedEventTargetWithInlineData<FileReader>::trace(visit or); 474 RefCountedGarbageCollectedEventTargetWithInlineData<FileReader>::trace(visit or);
475 ActiveDOMObject::trace(visitor); 475 ActiveDOMObject::trace(visitor);
476 } 476 }
477 477
478 } // namespace blink 478 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698