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

Side by Side Diff: Source/core/frame/LocalDOMWindow.cpp

Issue 1119683003: Implement requestIdleCallback API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 5 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | Source/core/frame/RemoteDOMWindow.h » ('j') | 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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
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 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 1257
1258 IntRect fr = host->chromeClient().windowRect(); 1258 IntRect fr = host->chromeClient().windowRect();
1259 IntSize dest = IntSize(width, height); 1259 IntSize dest = IntSize(width, height);
1260 IntRect update(fr.location(), dest); 1260 IntRect update(fr.location(), dest);
1261 host->chromeClient().setWindowRectWithAdjustment(update); 1261 host->chromeClient().setWindowRectWithAdjustment(update);
1262 } 1262 }
1263 1263
1264 int LocalDOMWindow::requestAnimationFrame(FrameRequestCallback* callback) 1264 int LocalDOMWindow::requestAnimationFrame(FrameRequestCallback* callback)
1265 { 1265 {
1266 callback->m_useLegacyTimeBase = false; 1266 callback->m_useLegacyTimeBase = false;
1267 if (Document* d = document()) 1267 if (Document* doc = document())
1268 return d->requestAnimationFrame(callback); 1268 return doc->requestAnimationFrame(callback);
1269 return 0; 1269 return 0;
1270 } 1270 }
1271 1271
1272 int LocalDOMWindow::webkitRequestAnimationFrame(FrameRequestCallback* callback) 1272 int LocalDOMWindow::webkitRequestAnimationFrame(FrameRequestCallback* callback)
1273 { 1273 {
1274 callback->m_useLegacyTimeBase = true; 1274 callback->m_useLegacyTimeBase = true;
1275 if (Document* d = document()) 1275 if (Document* document = this->document())
1276 return d->requestAnimationFrame(callback); 1276 return document->requestAnimationFrame(callback);
1277 return 0; 1277 return 0;
1278 } 1278 }
1279 1279
1280 void LocalDOMWindow::cancelAnimationFrame(int id) 1280 void LocalDOMWindow::cancelAnimationFrame(int id)
1281 { 1281 {
1282 if (Document* d = document()) 1282 if (Document* document = this->document())
1283 d->cancelAnimationFrame(id); 1283 document->cancelAnimationFrame(id);
1284 }
1285
1286 int LocalDOMWindow::requestIdleCallback(IdleRequestCallback* callback, double ti meoutMillis)
1287 {
1288 if (Document* document = this->document())
1289 return document->requestIdleCallback(callback, timeoutMillis);
1290 return 0;
1291 }
1292
1293 void LocalDOMWindow::cancelIdleCallback(int id)
1294 {
1295 if (Document* document = this->document())
1296 document->cancelIdleCallback(id);
1284 } 1297 }
1285 1298
1286 bool LocalDOMWindow::addEventListener(const AtomicString& eventType, PassRefPtrW illBeRawPtr<EventListener> prpListener, bool useCapture) 1299 bool LocalDOMWindow::addEventListener(const AtomicString& eventType, PassRefPtrW illBeRawPtr<EventListener> prpListener, bool useCapture)
1287 { 1300 {
1288 RefPtrWillBeRawPtr<EventListener> listener = prpListener; 1301 RefPtrWillBeRawPtr<EventListener> listener = prpListener;
1289 if (!EventTarget::addEventListener(eventType, listener, useCapture)) 1302 if (!EventTarget::addEventListener(eventType, listener, useCapture))
1290 return false; 1303 return false;
1291 1304
1292 if (frame() && frame()->host()) 1305 if (frame() && frame()->host())
1293 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype); 1306 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 DOMWindow::trace(visitor); 1500 DOMWindow::trace(visitor);
1488 DOMWindowLifecycleNotifier::trace(visitor); 1501 DOMWindowLifecycleNotifier::trace(visitor);
1489 } 1502 }
1490 1503
1491 LocalFrame* LocalDOMWindow::frame() const 1504 LocalFrame* LocalDOMWindow::frame() const
1492 { 1505 {
1493 return m_frameObserver->frame(); 1506 return m_frameObserver->frame();
1494 } 1507 }
1495 1508
1496 } // namespace blink 1509 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | Source/core/frame/RemoteDOMWindow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698