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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. 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
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 28 matching lines...) Expand all
39 #include "core/editing/Editor.h" 39 #include "core/editing/Editor.h"
40 #include "core/events/Event.h" 40 #include "core/events/Event.h"
41 #include "core/events/EventUtil.h" 41 #include "core/events/EventUtil.h"
42 #include "core/frame/FrameHost.h" 42 #include "core/frame/FrameHost.h"
43 #include "core/frame/LocalDOMWindow.h" 43 #include "core/frame/LocalDOMWindow.h"
44 #include "core/frame/Settings.h" 44 #include "core/frame/Settings.h"
45 #include "core/frame/UseCounter.h" 45 #include "core/frame/UseCounter.h"
46 #include "core/inspector/ConsoleMessage.h" 46 #include "core/inspector/ConsoleMessage.h"
47 #include "core/inspector/InspectorInstrumentation.h" 47 #include "core/inspector/InspectorInstrumentation.h"
48 #include "platform/EventDispatchForbiddenScope.h" 48 #include "platform/EventDispatchForbiddenScope.h"
49 #include "wtf/PtrUtil.h"
49 #include "wtf/StdLibExtras.h" 50 #include "wtf/StdLibExtras.h"
50 #include "wtf/Threading.h" 51 #include "wtf/Threading.h"
51 #include "wtf/Vector.h" 52 #include "wtf/Vector.h"
53 #include <memory>
52 54
53 using namespace WTF; 55 using namespace WTF;
54 56
55 namespace blink { 57 namespace blink {
56 namespace { 58 namespace {
57 59
58 Settings* windowSettings(LocalDOMWindow* executingWindow) 60 Settings* windowSettings(LocalDOMWindow* executingWindow)
59 { 61 {
60 if (executingWindow) { 62 if (executingWindow) {
61 if (LocalFrame* frame = executingWindow->frame()) { 63 if (LocalFrame* frame = executingWindow->frame()) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return; 102 return;
101 v8::Context::Scope contextScope(v8Context); 103 v8::Context::Scope contextScope(v8Context);
102 v8::Local<v8::Object> handler = v8Listener->getListenerObject(context); 104 v8::Local<v8::Object> handler = v8Listener->getListenerObject(context);
103 105
104 String messageText = String::format( 106 String messageText = String::format(
105 "Handling of '%s' input event was delayed for %ld ms due to main thread being busy. " 107 "Handling of '%s' input event was delayed for %ld ms due to main thread being busy. "
106 "Consider marking event handler as 'passive' to make the page more respo nive.", 108 "Consider marking event handler as 'passive' to make the page more respo nive.",
107 event->type().getString().utf8().data(), lround(delayedSeconds * 1000)); 109 event->type().getString().utf8().data(), lround(delayedSeconds * 1000));
108 110
109 v8::Local<v8::Function> function = eventListenerEffectiveFunction(v8Listener ->isolate(), handler); 111 v8::Local<v8::Function> function = eventListenerEffectiveFunction(v8Listener ->isolate(), handler);
110 OwnPtr<SourceLocation> location = SourceLocation::fromFunction(function); 112 std::unique_ptr<SourceLocation> location = SourceLocation::fromFunction(func tion);
111 ConsoleMessage* message = ConsoleMessage::create(JSMessageSource, WarningMes sageLevel, messageText, std::move(location)); 113 ConsoleMessage* message = ConsoleMessage::create(JSMessageSource, WarningMes sageLevel, messageText, std::move(location));
112 context->addConsoleMessage(message); 114 context->addConsoleMessage(message);
113 registeredListener->setBlockedEventWarningEmitted(); 115 registeredListener->setBlockedEventWarningEmitted();
114 } 116 }
115 117
116 118
117 } // namespace 119 } // namespace
118 120
119 EventTargetData::EventTargetData() 121 EventTargetData::EventTargetData()
120 { 122 {
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 UseCounter::count(executingWindow->document(), UseCounter::TextInput Fired); 547 UseCounter::count(executingWindow->document(), UseCounter::TextInput Fired);
546 } 548 }
547 549
548 ExecutionContext* context = getExecutionContext(); 550 ExecutionContext* context = getExecutionContext();
549 if (!context) 551 if (!context)
550 return false; 552 return false;
551 553
552 size_t i = 0; 554 size_t i = 0;
553 size_t size = entry.size(); 555 size_t size = entry.size();
554 if (!d->firingEventIterators) 556 if (!d->firingEventIterators)
555 d->firingEventIterators = adoptPtr(new FiringEventIteratorVector); 557 d->firingEventIterators = wrapUnique(new FiringEventIteratorVector);
556 d->firingEventIterators->append(FiringEventIterator(event->type(), i, size)) ; 558 d->firingEventIterators->append(FiringEventIterator(event->type(), i, size)) ;
557 559
558 double blockedEventThreshold = blockedEventsWarningThreshold(context, event) ; 560 double blockedEventThreshold = blockedEventsWarningThreshold(context, event) ;
559 double now = 0.0; 561 double now = 0.0;
560 bool shouldReportBlockedEvent = false; 562 bool shouldReportBlockedEvent = false;
561 if (blockedEventThreshold) { 563 if (blockedEventThreshold) {
562 now = WTF::monotonicallyIncreasingTime(); 564 now = WTF::monotonicallyIncreasingTime();
563 shouldReportBlockedEvent = now - event->platformTimeStamp() > blockedEve ntThreshold; 565 shouldReportBlockedEvent = now - event->platformTimeStamp() > blockedEve ntThreshold;
564 } 566 }
565 bool firedListener = false; 567 bool firedListener = false;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 // they have one less listener to invoke. 644 // they have one less listener to invoke.
643 if (d->firingEventIterators) { 645 if (d->firingEventIterators) {
644 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 646 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
645 d->firingEventIterators->at(i).iterator = 0; 647 d->firingEventIterators->at(i).iterator = 0;
646 d->firingEventIterators->at(i).end = 0; 648 d->firingEventIterators->at(i).end = 0;
647 } 649 }
648 } 650 }
649 } 651 }
650 652
651 } // namespace blink 653 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/EventTarget.h ('k') | third_party/WebKit/Source/core/events/GenericEventQueue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698