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/EventDispatcher.cpp

Issue 1835303002: Implementation of the GreenWeb language extensions. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change GreenWeb-related CSS property names such that they apply in the desired order at runtime. 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) 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, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public 11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either 12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version. 13 * version 2 of the License, or (at your option) any later version.
14 * 14 *
15 * This library is distributed in the hope that it will be useful, 15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details. 18 * Library General Public License for more details.
19 * 19 *
20 * You should have received a copy of the GNU Library General Public License 20 * You should have received a copy of the GNU Library General Public License
21 * along with this library; see the file COPYING.LIB. If not, write to 21 * along with this library; see the file COPYING.LIB. If not, write to
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA. 23 * Boston, MA 02110-1301, USA.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/events/EventDispatcher.h" 27 #include "core/events/EventDispatcher.h"
28 28
29 #include <iostream>
30 #include <string>
31
32 #include "content/renderer/greenweb_latency_tracking.h"
29 #include "core/dom/ContainerNode.h" 33 #include "core/dom/ContainerNode.h"
30 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
31 #include "core/dom/Element.h" 35 #include "core/dom/Element.h"
36 #include "core/dom/NodeComputedStyle.h"
32 #include "core/events/EventDispatchMediator.h" 37 #include "core/events/EventDispatchMediator.h"
33 #include "core/events/MouseEvent.h" 38 #include "core/events/MouseEvent.h"
34 #include "core/events/ScopedEventQueue.h" 39 #include "core/events/ScopedEventQueue.h"
35 #include "core/events/WindowEventContext.h" 40 #include "core/events/WindowEventContext.h"
36 #include "core/frame/FrameView.h" 41 #include "core/frame/FrameView.h"
37 #include "core/frame/LocalDOMWindow.h" 42 #include "core/frame/LocalDOMWindow.h"
38 #include "core/inspector/InspectorTraceEvents.h" 43 #include "core/inspector/InspectorTraceEvents.h"
44 #include "core/style/ComputedStyle.h"
39 #include "platform/EventDispatchForbiddenScope.h" 45 #include "platform/EventDispatchForbiddenScope.h"
40 #include "platform/TraceEvent.h" 46 #include "platform/TraceEvent.h"
41 #include "wtf/RefPtr.h" 47 #include "wtf/RefPtr.h"
42 48
49 char g_qos_type = 'u';
50 int g_qos_target = 0;
51 bool g_ebs_enabled = false;
52
43 namespace blink { 53 namespace blink {
44 54
45 bool EventDispatcher::dispatchEvent(Node& node, PassRefPtrWillBeRawPtr<EventDisp atchMediator> mediator) 55 bool EventDispatcher::dispatchEvent(Node& node, PassRefPtrWillBeRawPtr<EventDisp atchMediator> mediator)
46 { 56 {
47 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "EventDispatcher::dis patchEvent"); 57 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "EventDispatcher::dis patchEvent");
48 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); 58 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden());
49 EventDispatcher dispatcher(node, &mediator->event()); 59 EventDispatcher dispatcher(node, &mediator->event());
50 return mediator->dispatchEvent(dispatcher); 60 return mediator->dispatchEvent(dispatcher);
51 } 61 }
52 62
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // Some elements (e.g. the color picker) may set active state to true before 105 // Some elements (e.g. the color picker) may set active state to true before
96 // calling this method and expect the state to be reset during the call. 106 // calling this method and expect the state to be reset during the call.
97 node.setActive(false); 107 node.setActive(false);
98 108
99 // always send click 109 // always send click
100 EventDispatcher(node, MouseEvent::create(EventTypeNames::click, node.documen t().domWindow(), underlyingEvent, creationScope)).dispatch(); 110 EventDispatcher(node, MouseEvent::create(EventTypeNames::click, node.documen t().domWindow(), underlyingEvent, creationScope)).dispatch();
101 111
102 nodesDispatchingSimulatedClicks->remove(&node); 112 nodesDispatchingSimulatedClicks->remove(&node);
103 } 113 }
104 114
115 bool init_ebs(bool *mode)
116 {
117 FILE* arg_file;
118 arg_file = fopen("/data/local/tmp/chrome-shell-command-line", "r");
119 if (!arg_file) {
120 dbg_sched_fprintf(stdout, "[EBS] arg file open failed\n");
121 return false;
122 }
123 dbg_sched_fprintf(stdout, "[EBS] arg file opened\n");
124
125 char arg_list[100];
126 fgets(arg_list, 100, arg_file);
127 fclose(arg_file);
128
129 if (arg_list[13] == '-'
130 && arg_list[14] == '-'
131 && arg_list[15] == 'e'
132 && arg_list[16] == 'b'
133 && arg_list[17] == 's'
134 && arg_list[18] == '-'
135 && arg_list[19] == 'p')
136 {
137 if (arg_list[20] == 'i') {
138 *mode = true;
139 dbg_sched_fprintf(stdout, "[EBS] ebs enabled. Using Pi\n");
140 return true;
141 }
142 if (arg_list[20] == 'u') {
143 *mode = false;
144 dbg_sched_fprintf(stdout, "[EBS] ebs enabled. Using Pu\n");
145 return true;
146 }
147 }
148
149 return false;
150 }
151
152 void set_freq(uint32 freq)
153 {
154 FILE* cpufreq = NULL;
155
156 if (!cpufreq) {
157 cpufreq = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed", "w");
158 if (!cpufreq)
159 dbg_sched_fprintf(stdout, "[EBS] file open failed\n");
160 else
161 dbg_sched_fprintf(stdout, "[EBS] freq file open succeeded\n");
162 }
163
164 if (cpufreq) {
165 int bytes = fprintf(cpufreq, "%u", freq);
166 if ((bytes != 6) && (bytes != 7)) {
167 dbg_sched_fprintf(stdout, "[EBS] cpufreq not set\n");
168 } else {
169 dbg_sched_fprintf(stdout, "[EBS] freq set to %d\n", freq);
170 #ifdef EBS_DEBUG_TRACE_EVENT
171 TRACE_EVENT2("devtools.timeline", "EBS:Schedule",
172 "log", "freq set",
173 "freq", freq);
174 #endif
175 }
176 fclose(cpufreq);
177 }
178 }
179
180 void schedule(uint32 last_state, int64 last_latency, uint32 *next_state, uint32 *next_freq, int qos_target, FreqLatencyMap *freq_map, int64 dom_node_id)
181 {
182 // FSM state explanation:
183 // 0xFF - Calibrating on big core, 1.6G
184 // 0x00 - Calibrating on big core, 0.8G
185 // 0x01 - Calibrating on little core, 0.6G
186 // 0x02 - Calibrating on little core, 0.4G
187 // 0xN - Running on core with frequency N/10 GHz (N = 3~16)
188
189 // First time we run an event on this node. Run with 1.6G.
190 // ODroid doesn't allow setting all 4 cores to 1.8G.
191 if (last_latency == 0) {
192 *next_state = 0xFF;
193 *next_freq = 1600000;
194 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: Now calibrate on 1.6G\ n", last_state, *next_state);
195 return;
196 }
197
198 // Second time we run an event on this node. Run with 0.8G.
199 if (last_state == 0xFF) {
200 *next_state = 0;
201 *next_freq = 800000;
202 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: Now calibrate on 0.8G\ n", last_state, *next_state);
203 } else if (last_state == 0) {
204 // Finished the two profiling runs on the big core.
205 int64 time_8 = (*freq_map)[800000];
206 int64 time_16 = (*freq_map)[1600000];
207
208 if (qos_target <= time_16) {
209 // Have to provision the highest conf.
210 *next_state = 16;
211 *next_freq = 1600000;
212 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: T16 > Target. Have to use the highest big\n", last_state, *next_state);
213 } else if (qos_target >= time_8) {
214 // Try the little core
215 *next_state = 1;
216 *next_freq = 600000;
217 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: T8 < Target. Now c alibrate on 0.6G\n", last_state, *next_state);
218 } else {
219 if (time_8 <= time_16) {
220 // Recalibrate on the big core
221 *next_state = 0xFF;
222 *next_freq = 1600000;
223 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: T8 < T16. Reca librate on big\n", last_state, *next_state);
224 } else {
225 double beta = (time_8 - time_16) * 1.6 * 1000000;
226 double alpha = time_8 - beta / 800000;
227 *next_freq = (int)(beta / (qos_target - alpha) + 1) / 100000 * 1 00000;
228 *next_state = *next_freq / 100000;
229 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: On big, predic ted by model\n", last_state, *next_state);
230 }
231 }
232 } else if (last_state == 1) {
233 // First profiling run on the little core.
234 *next_state = 2;
235 // Never uses 300 MHz, beucase it leads to more energy than 400 MHz
236 *next_freq = 400000;
237 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: Now calibrate on 0.4G\ n", last_state, *next_state);
238 } else if (last_state == 2) {
239 // Finished the two profiling runs on the little core.
240 int64 time_4 = (*freq_map)[400000];
241 int64 time_6 = (*freq_map)[600000];
242
243 if (qos_target <= time_6) {
244 // Recalibrate on the big core
245 *next_state = 0xFF;
246 *next_freq = 1600000;
247 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: T6 > Target. Recal ibrate on big\n", last_state, *next_state);
248 } else if (qos_target >= time_4) {
249 // It's safe to provision the lowest on the little core
250 *next_state = 4;
251 *next_freq = 400000;
252 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: T4 < Target. Safe to use the lowest little\n", last_state, *next_state);
253 } else {
254 if (time_4 <= time_6) {
255 // Recalibrate on the little core
256 *next_state = 1;
257 *next_freq = 600000;
258 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: T4 < T6. Recal ibrate on little\n", last_state, *next_state);
259 } else {
260 double beta = (time_4 - time_6) * 1.2 * 1000000;
261 double alpha = time_4 - beta / 400000;
262 *next_freq = (int)(beta / (qos_target - alpha) + 1) / 100000 * 1 00000;
263 *next_state = *next_freq / 100000;
264 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: On little, pre dicted by model\n", last_state, *next_state);
265 }
266 }
267 } else {
268 // Fine tune phase, depending on the last_latency.
269 static std::map<int64, int> underpred;
270 static std::map<int64, int> overpred;
271
272 if (last_latency < qos_target * 0.8) {
273 // Overpredicting
274 if (last_state == 4) {
275 // Already lowest. Nothing we can do.
276 *next_state = last_state;
277 *next_freq = (*next_state) * 100000;
278 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: Keep the last prediction\n", last_state, *next_state);
279 return;
280 }
281
282 underpred[dom_node_id] = 0;
283 overpred[dom_node_id]++;
284
285 if (overpred[dom_node_id] <= 2) {
286 if (last_state == 4)
287 *next_state = 4;
288 else if (last_state == 8)
289 *next_state = 6;
290 else
291 *next_state = last_state - 1;
292 *next_freq = (*next_state) * 100000;
293 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: Overpredict\n" , last_state, *next_state);
294 } else if (overpred[dom_node_id] <= 4) {
295 if (last_state <= 5)
296 *next_state = 4;
297 else if (last_state == 9)
298 *next_state = 6;
299 else
300 *next_state = last_state - 2;
301 *next_freq = (*next_state) * 100000;
302 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: Too many overp redict\n", last_state, *next_state);
303 } else {
304 overpred[dom_node_id] = 0;
305 *next_state = 0xFF;
306 *next_freq = 1600000;
307 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: Way too many o verpredict\n", last_state, *next_state);
308 }
309 } else if (last_latency > qos_target * 0.9) {
310 // Underpredicting
311 if (last_state == 16) {
312 // Already highest. Nothing we can do.
313 *next_state = last_state;
314 *next_freq = (*next_state) * 100000;
315 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: Keep the last prediction\n", last_state, *next_state);
316 return;
317 }
318
319 overpred[dom_node_id] = 0;
320 underpred[dom_node_id]++;
321
322 if (underpred[dom_node_id] <= 2) {
323 if (last_state == 16)
324 *next_state = 16;
325 else if (last_state == 6)
326 *next_state = 8;
327 else
328 *next_state = last_state + 1;
329 *next_freq = (*next_state) * 100000;
330 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: Underpredict\n ", last_state, *next_state);
331 } else if (underpred[dom_node_id] <= 4) {
332 if (last_state >= 15)
333 *next_state = 16;
334 else if (last_state == 5)
335 *next_state = 8;
336 else
337 *next_state = last_state + 2;
338 *next_freq = (*next_state) * 100000;
339 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: Too many under predict\n", last_state, *next_state);
340 } else {
341 underpred[dom_node_id] = 0;
342 *next_state = 0xFF;
343 *next_freq = 1600000;
344 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: Way too many u nderpredict\n", last_state, *next_state);
345 }
346 } else {
347 overpred[dom_node_id] = 0;
348 underpred[dom_node_id] = 0;
349 *next_state = last_state;
350 *next_freq = (*next_state) * 100000;
351 dbg_sched_fprintf(stdout, "[EBS] state %d --> %d: Keep the last pred iction\n", last_state, *next_state);
352 }
353 }
354
355 #ifdef EBS_DEBUG_TRACE_EVENT
356 TRACE_EVENT2("devtools.timeline", "EBS:Schedule",
357 "last_state", last_state,
358 "next_state", *next_state);
359 #endif
360 }
361
362 int isEventSupported(String event_name)
363 {
364 if (event_name == "click")
365 return 1;
366 else if(event_name == "touchstart")
367 return 2;
368 else if(event_name == "touchend")
369 return 3;
370 else if(event_name == "scroll")
371 return 4;
372 else if(event_name == "touchmove")
373 return 5;
374 return 0;
375 }
376
377 void EventDispatcher::retriveQoSInfo(bool mode, int event)
378 {
379 int pi, pu, type;
380
381 // TODO: handle cases where multiple events register callbacks on one node
382 switch (event) {
383 case 1: // click
384 pi = m_node->computedStyle()->onclickVpi();
385 pu = m_node->computedStyle()->onclickVpu();
386 type = m_node->computedStyle()->onclickType();
387 break;
388 case 2: // touchstart
389 pi = m_node->computedStyle()->ontouchstartVpi();
390 pu = m_node->computedStyle()->ontouchstartVpu();
391 type = m_node->computedStyle()->ontouchstartType();
392 break;
393 case 3: // touchend
394 pi = m_node->computedStyle()->ontouchendVpi();
395 pu = m_node->computedStyle()->ontouchendVpu();
396 type = m_node->computedStyle()->ontouchendType();
397 break;
398 case 4: // scroll
399 pi = m_node->computedStyle()->onscrollVpi();
400 pu = m_node->computedStyle()->onscrollVpu();
401 type = m_node->computedStyle()->onscrollType();
402 break;
403 case 5: // touchmove
404 pi = m_node->computedStyle()->ontouchmoveVpi();
405 pu = m_node->computedStyle()->ontouchmoveVpu();
406 type = m_node->computedStyle()->ontouchmoveType();
407 break;
408 default: // Should never reach here
409 dbg_sched_fprintf(stdout, "[EBS] Wrong event id. Should never reach here!\n");
410 ASSERT_NOT_REACHED();
411 return;
412 }
413
414 g_qos_target = mode ? pi : pu;
415
416 std::string QoSType;
417 if (type == 0)
418 QoSType = "single";
419 else
420 QoSType = "continuous";
421 g_qos_type = QoSType[0];
422
423 dbg_sched_cout("Node " << m_node->nodeName().utf8().data() <<
424 " on" << m_event->type().string().utf8().data() <<
425 ": (" << QoSType << ")" <<
426 " [" << pi << ", " << pu << "]");
427 }
428
105 bool EventDispatcher::dispatch() 429 bool EventDispatcher::dispatch()
106 { 430 {
107 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "EventDispatcher::dis patch"); 431 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "EventDispatcher::dis patch");
108 432
109 #if ENABLE(ASSERT) 433 #if ENABLE(ASSERT)
110 ASSERT(!m_eventDispatched); 434 ASSERT(!m_eventDispatched);
111 m_eventDispatched = true; 435 m_eventDispatched = true;
112 #endif 436 #endif
113 if (event().eventPath().isEmpty()) { 437 if (event().eventPath().isEmpty()) {
114 // eventPath() can be empty if event path is shrinked by relataedTarget retargeting. 438 // eventPath() can be empty if event path is shrinked by relataedTarget retargeting.
115 return true; 439 return true;
116 } 440 }
117 m_event->eventPath().ensureWindowEventContext(); 441 m_event->eventPath().ensureWindowEventContext();
118 442
119 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(*m_node)); 443 m_event->setTarget(EventPath::eventTargetRespectingTargetRules(*m_node));
120 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); 444 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden());
121 ASSERT(m_event->target()); 445 ASSERT(m_event->target());
122 TRACE_EVENT1("devtools.timeline", "EventDispatch", "data", InspectorEventDis patchEvent::data(*m_event)); 446 TRACE_EVENT1("devtools.timeline", "EventDispatch", "data", InspectorEventDis patchEvent::data(*m_event));
447
448 static bool init = false;
449 static bool mode = true; // true-Pi, false-Pu
450
451 if (!init) {
452 init = true;
453 g_ebs_enabled = init_ebs(&mode);
454 }
455
456 String event_name = m_event->type().string();
457 int event_id = isEventSupported(event_name);
458 if (event_id) {
459 int64 dom_node_id = reinterpret_cast<int64>(m_node.get());
460 InputLatencyMap[InputLatencyID].dom_node = dom_node_id;
461
462 if (g_ebs_enabled && m_node->computedStyle()) {
463 retriveQoSInfo(mode, event_id);
464
465 // Deal with the single QoS type here. The GPU process deals with th e continuous case.
466 if (g_qos_type == 's') {
467 // Memoize the freq to latency mapping for each DOM node.
468 // Used for constructing/calibrating the model and prediction.
469 // Data structure: std::map<int64, std::map<uint32, int64>>
470 static NodeFreqLatencyMap EBSCoreMap;
471 // Memoize the latency, state, and freq for each DOM node
472 // when it was executed last time.
473 static std::map<int64, int64> last_latency;
474 static std::map<int64, uint32> last_state;
475 static std::map<int64, uint32> last_freq;
476
477 uint32 last_state_t = last_state[dom_node_id];
478 uint32 last_freq_t = last_freq[dom_node_id];
479
480 if (DOMLatencyMap.find(dom_node_id) != DOMLatencyMap.end()) {
481 // Updating last_latency of this DOM node.
482 // This could not be done eagerly before it's actually execu ted.
483 last_latency[dom_node_id] = DOMLatencyMap[dom_node_id].laten cy;
484 EBSCoreMap[dom_node_id][last_freq_t] = last_latency[dom_node _id];
485 }
486 #ifdef EBS_DEBUG_TRACE_EVENT
487 TRACE_EVENT2("devtools.timeline", "GreenWeb:EventDispatch",
488 "trace_id", InputLatencyID,
489 "last_latency", DOMLatencyMap[dom_node_id].latency) ;
490 #endif
491 dbg_sched_cout("[EBS] trace_id " << InputLatencyID <<
492 " dom_node " << dom_node_id <<
493 " last_freq " << last_freq_t <<
494 " last_latency " << DOMLatencyMap[dom_node_id].la tency);
495
496 uint32 next_state;
497 uint32 next_freq;
498 int64 last_latency_t = last_latency[dom_node_id];
499
500 schedule(last_state_t,
501 last_latency_t,
502 &next_state,
503 &next_freq,
504 g_qos_target,
505 &EBSCoreMap[dom_node_id],
506 dom_node_id);
507 set_freq(next_freq);
508
509 // Early updating last_state and last_freq of this DOM node.
510 // Next time we see this DOM node, its last_state and last_freq
511 // is the next_state and next_freq set in the previous run.
512 // Note that the last_latency of a DOM node can only be set
513 // when it's seen the next time -- it has to be executed befor e
514 // we know it's latency!
515 last_state[dom_node_id] = next_state;
516 last_freq[dom_node_id] = next_freq;
517 }
518 } else { // EBS not enabled
519 #ifdef EBS_DEBUG_OS
520 std::cout << "[OS] dom_node " << dom_node_id << " last_latency " << DOMLatencyMap[dom_node_id].latency << std::endl;
521 for (int i = 4; i <= 16; i++) {
522 if (i == 7)
523 continue;
524 std::cout << i * 100000 << " " << DOMLatencyMap[dom_node_id].Fre qStatMap[i * 100000] << std::endl;
525 }
526 fprintf(stdout, " \n");
527 #endif
528 }
529 }
530
531 static int counter_s = 0;
532 if ((counter_s != 4) && !strcmp(m_event->type().string().utf8().data(), "rea dystatechange")) {
533 if (++counter_s == 4)
534 fprintf(stdout, "PageStart\n");
535 }
536 fflush(stdout);
537
123 void* preDispatchEventHandlerResult; 538 void* preDispatchEventHandlerResult;
124 if (dispatchEventPreProcess(preDispatchEventHandlerResult) == ContinueDispat ching) { 539 if (dispatchEventPreProcess(preDispatchEventHandlerResult) == ContinueDispat ching) {
125 if (dispatchEventAtCapturing() == ContinueDispatching) { 540 if (dispatchEventAtCapturing() == ContinueDispatching) {
126 if (dispatchEventAtTarget() == ContinueDispatching) 541 if (dispatchEventAtTarget() == ContinueDispatching)
127 dispatchEventAtBubbling(); 542 dispatchEventAtBubbling();
128 } 543 }
129 } 544 }
130 dispatchEventPostProcess(preDispatchEventHandlerResult); 545 dispatchEventPostProcess(preDispatchEventHandlerResult);
131 546
132 // Ensure that after event dispatch, the event's target object is the 547 // Ensure that after event dispatch, the event's target object is the
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 m_event->eventPath()[i].node()->defaultEventHandler(m_event.get( )); 641 m_event->eventPath()[i].node()->defaultEventHandler(m_event.get( ));
227 ASSERT(!m_event->defaultPrevented()); 642 ASSERT(!m_event->defaultPrevented());
228 if (m_event->defaultHandled()) 643 if (m_event->defaultHandled())
229 return; 644 return;
230 } 645 }
231 } 646 }
232 } 647 }
233 } 648 }
234 649
235 } 650 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/EventDispatcher.h ('k') | third_party/WebKit/Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698