Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 #include "wtf/InstanceCounter.h" | 149 #include "wtf/InstanceCounter.h" |
| 150 #include "wtf/PassOwnPtr.h" | 150 #include "wtf/PassOwnPtr.h" |
| 151 #include "wtf/dtoa.h" | 151 #include "wtf/dtoa.h" |
| 152 #include "wtf/text/StringBuffer.h" | 152 #include "wtf/text/StringBuffer.h" |
| 153 #include <v8.h> | 153 #include <v8.h> |
| 154 | 154 |
| 155 namespace blink { | 155 namespace blink { |
| 156 | 156 |
| 157 namespace { | 157 namespace { |
| 158 | 158 |
| 159 class InternalsIterator final : public Iterator { | 159 class InternalsIterationSource final : public ValueIterable<int>::IterationSourc e { |
| 160 public: | 160 public: |
| 161 InternalsIterator() : m_current(0) { } | 161 virtual bool next(ScriptState* scriptState, int& value, ExceptionState& exce ptionState) override |
|
yhirano
2015/01/13 05:18:42
No virtual is needed.
Jens Widell
2015/01/13 07:50:06
Done.
| |
| 162 | |
| 163 virtual ScriptValue next(ScriptState* scriptState, ExceptionState& exception State) override | |
| 164 { | 162 { |
| 165 int value = m_current * m_current; | 163 if (m_index >= 5) |
| 166 if (m_current >= 5) | 164 return false; |
| 167 return v8IteratorResultDone(scriptState); | 165 value = m_index * m_index; |
| 168 ++m_current; | 166 return true; |
| 169 return v8IteratorResult(scriptState, value); | |
| 170 } | 167 } |
| 171 | |
| 172 virtual ScriptValue next(ScriptState* scriptState, ScriptValue value, Except ionState& exceptionState) override | |
| 173 { | |
| 174 exceptionState.throwTypeError("Not implemented"); | |
| 175 return ScriptValue(); | |
| 176 } | |
| 177 | |
| 178 private: | |
| 179 int m_current; | |
| 180 }; | 168 }; |
| 181 | 169 |
| 182 } // namespace | 170 } // namespace |
| 183 | 171 |
| 184 static bool markerTypesFrom(const String& markerType, DocumentMarker::MarkerType s& result) | 172 static bool markerTypesFrom(const String& markerType, DocumentMarker::MarkerType s& result) |
| 185 { | 173 { |
| 186 if (markerType.isEmpty() || equalIgnoringCase(markerType, "all")) | 174 if (markerType.isEmpty() || equalIgnoringCase(markerType, "all")) |
| 187 result = DocumentMarker::AllMarkers(); | 175 result = DocumentMarker::AllMarkers(); |
| 188 else if (equalIgnoringCase(markerType, "Spelling")) | 176 else if (equalIgnoringCase(markerType, "Spelling")) |
| 189 result = DocumentMarker::Spelling; | 177 result = DocumentMarker::Spelling; |
| (...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2357 | 2345 |
| 2358 void Internals::forcePluginPlaceholder(HTMLElement* element, const PluginPlaceho lderOptions& options, ExceptionState& exceptionState) | 2346 void Internals::forcePluginPlaceholder(HTMLElement* element, const PluginPlaceho lderOptions& options, ExceptionState& exceptionState) |
| 2359 { | 2347 { |
| 2360 if (!element->isPluginElement()) { | 2348 if (!element->isPluginElement()) { |
| 2361 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin."); | 2349 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a plugin."); |
| 2362 return; | 2350 return; |
| 2363 } | 2351 } |
| 2364 toHTMLPlugInElement(element)->setPlaceholder(DictionaryPluginPlaceholder::cr eate(element->document(), options)); | 2352 toHTMLPlugInElement(element)->setPlaceholder(DictionaryPluginPlaceholder::cr eate(element->document(), options)); |
| 2365 } | 2353 } |
| 2366 | 2354 |
| 2367 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio nState) | |
| 2368 { | |
| 2369 return new InternalsIterator; | |
| 2370 } | |
| 2371 | |
| 2372 void Internals::forceBlinkGCWithoutV8GC() | 2355 void Internals::forceBlinkGCWithoutV8GC() |
| 2373 { | 2356 { |
| 2374 ThreadState::current()->scheduleGC(); | 2357 ThreadState::current()->scheduleGC(); |
| 2375 } | 2358 } |
| 2376 | 2359 |
| 2360 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc eptionState&) | |
| 2361 { | |
| 2362 return new InternalsIterationSource(); | |
| 2363 } | |
| 2364 | |
| 2377 } // namespace blink | 2365 } // namespace blink |
| OLD | NEW |