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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2811863002: Move ScriptState::GetExecutionContext (Part 4) (Closed)
Patch Set: Created 3 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 #include "wtf/DateMath.h" 254 #include "wtf/DateMath.h"
255 #include "wtf/Functional.h" 255 #include "wtf/Functional.h"
256 #include "wtf/HashFunctions.h" 256 #include "wtf/HashFunctions.h"
257 #include "wtf/PtrUtil.h" 257 #include "wtf/PtrUtil.h"
258 #include "wtf/StdLibExtras.h" 258 #include "wtf/StdLibExtras.h"
259 #include "wtf/text/CharacterNames.h" 259 #include "wtf/text/CharacterNames.h"
260 #include "wtf/text/StringBuffer.h" 260 #include "wtf/text/StringBuffer.h"
261 #include "wtf/text/TextEncodingRegistry.h" 261 #include "wtf/text/TextEncodingRegistry.h"
262 262
263 #include <memory> 263 #include <memory>
264 #include "core/dom/ExecutionContext.h"
jbroman 2017/04/11 00:07:57 nit: this should be in the list of includes above,
adithyas 2017/04/11 15:13:47 Ah good catch, my script didn't really account for
264 265
265 #ifndef NDEBUG 266 #ifndef NDEBUG
266 using WeakDocumentSet = 267 using WeakDocumentSet =
267 blink::PersistentHeapHashSet<blink::WeakMember<blink::Document>>; 268 blink::PersistentHeapHashSet<blink::WeakMember<blink::Document>>;
268 static WeakDocumentSet& liveDocumentSet(); 269 static WeakDocumentSet& liveDocumentSet();
269 #endif 270 #endif
270 271
271 namespace blink { 272 namespace blink {
272 273
273 using namespace HTMLNames; 274 using namespace HTMLNames;
(...skipping 4241 matching lines...) Expand 10 before | Expand all | Expand 10 after
4515 void Document::RegisterEventFactory( 4516 void Document::RegisterEventFactory(
4516 std::unique_ptr<EventFactoryBase> event_factory) { 4517 std::unique_ptr<EventFactoryBase> event_factory) {
4517 DCHECK(!EventFactories().Contains(event_factory.get())); 4518 DCHECK(!EventFactories().Contains(event_factory.get()));
4518 EventFactories().insert(std::move(event_factory)); 4519 EventFactories().insert(std::move(event_factory));
4519 } 4520 }
4520 4521
4521 Event* Document::createEvent(ScriptState* script_state, 4522 Event* Document::createEvent(ScriptState* script_state,
4522 const String& event_type, 4523 const String& event_type,
4523 ExceptionState& exception_state) { 4524 ExceptionState& exception_state) {
4524 Event* event = nullptr; 4525 Event* event = nullptr;
4525 ExecutionContext* execution_context = script_state->GetExecutionContext(); 4526 ExecutionContext* execution_context = ExecutionContext::From(script_state);
4526 for (const auto& factory : EventFactories()) { 4527 for (const auto& factory : EventFactories()) {
4527 event = factory->Create(execution_context, event_type); 4528 event = factory->Create(execution_context, event_type);
4528 if (event) { 4529 if (event) {
4529 // createEvent for TouchEvent should throw DOM exception if touch event 4530 // createEvent for TouchEvent should throw DOM exception if touch event
4530 // feature detection is not enabled. See crbug.com/392584#c22 4531 // feature detection is not enabled. See crbug.com/392584#c22
4531 if (EqualIgnoringCase(event_type, "TouchEvent") && 4532 if (EqualIgnoringCase(event_type, "TouchEvent") &&
4532 !RuntimeEnabledFeatures::touchEventFeatureDetectionEnabled()) 4533 !RuntimeEnabledFeatures::touchEventFeatureDetectionEnabled())
4533 break; 4534 break;
4534 return event; 4535 return event;
4535 } 4536 }
(...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
6660 } 6661 }
6661 6662
6662 void showLiveDocumentInstances() { 6663 void showLiveDocumentInstances() {
6663 WeakDocumentSet& set = liveDocumentSet(); 6664 WeakDocumentSet& set = liveDocumentSet();
6664 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6665 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6665 for (blink::Document* document : set) 6666 for (blink::Document* document : set)
6666 fprintf(stderr, "- Document %p URL: %s\n", document, 6667 fprintf(stderr, "- Document %p URL: %s\n", document,
6667 document->Url().GetString().Utf8().Data()); 6668 document->Url().GetString().Utf8().Data());
6668 } 6669 }
6669 #endif 6670 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/FontFace.cpp ('k') | third_party/WebKit/Source/core/dom/MessagePort.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698