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

Side by Side Diff: third_party/WebKit/Source/core/events/EventTarget.cpp

Issue 2039453003: Fix crash in blocked input event warning. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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) 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 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 return frameHost->settings().blockedMainThreadEventsWarningThreshold(); 88 return frameHost->settings().blockedMainThreadEventsWarningThreshold();
89 } 89 }
90 90
91 void reportBlockedEvent(ExecutionContext* context, const Event* event, Registere dEventListener* registeredListener, double delayedSeconds) 91 void reportBlockedEvent(ExecutionContext* context, const Event* event, Registere dEventListener* registeredListener, double delayedSeconds)
92 { 92 {
93 if (registeredListener->listener()->type() != EventListener::JSEventListener Type) 93 if (registeredListener->listener()->type() != EventListener::JSEventListener Type)
94 return; 94 return;
95 95
96 V8AbstractEventListener* v8Listener = V8AbstractEventListener::cast(register edListener->listener()); 96 V8AbstractEventListener* v8Listener = V8AbstractEventListener::cast(register edListener->listener());
97 v8::HandleScope handles(v8Listener->isolate()); 97 v8::HandleScope handles(v8Listener->isolate());
98 v8::Local<v8::Context> v8Context = toV8Context(context, v8Listener->world()) ;
99 if (v8Context.IsEmpty())
100 return;
101 v8::Context::Scope contextScope(v8Context);
98 v8::Local<v8::Object> handler = v8Listener->getListenerObject(context); 102 v8::Local<v8::Object> handler = v8Listener->getListenerObject(context);
99 103
100 String messageText = String::format( 104 String messageText = String::format(
101 "Handling of '%s' input event was delayed for %ld ms due to main thread being busy. " 105 "Handling of '%s' input event was delayed for %ld ms due to main thread being busy. "
102 "Consider marking event handler as 'passive' to make the page more respo nive.", 106 "Consider marking event handler as 'passive' to make the page more respo nive.",
103 event->type().getString().utf8().data(), lround(delayedSeconds * 1000)); 107 event->type().getString().utf8().data(), lround(delayedSeconds * 1000));
104 108
105 v8::Local<v8::Function> function = eventListenerEffectiveFunction(v8Listener ->isolate(), handler); 109 v8::Local<v8::Function> function = eventListenerEffectiveFunction(v8Listener ->isolate(), handler);
106 OwnPtr<SourceLocation> location = SourceLocation::fromFunction(function); 110 OwnPtr<SourceLocation> location = SourceLocation::fromFunction(function);
107 ConsoleMessage* message = ConsoleMessage::create(JSMessageSource, WarningMes sageLevel, messageText, std::move(location)); 111 ConsoleMessage* message = ConsoleMessage::create(JSMessageSource, WarningMes sageLevel, messageText, std::move(location));
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 // they have one less listener to invoke. 642 // they have one less listener to invoke.
639 if (d->firingEventIterators) { 643 if (d->firingEventIterators) {
640 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 644 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
641 d->firingEventIterators->at(i).iterator = 0; 645 d->firingEventIterators->at(i).iterator = 0;
642 d->firingEventIterators->at(i).end = 0; 646 d->firingEventIterators->at(i).end = 0;
643 } 647 }
644 } 648 }
645 } 649 }
646 650
647 } // namespace blink 651 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698