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

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

Issue 805773004: Create DOMWindowStorage as a DOMWindowLifecycleObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rename Created 6 years 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 | « Source/core/core.gypi ('k') | Source/core/storage/DOMWindowStorageController.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 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 d->cancelAnimationFrame(id); 1564 d->cancelAnimationFrame(id);
1565 } 1565 }
1566 1566
1567 DOMWindowCSS* LocalDOMWindow::css() const 1567 DOMWindowCSS* LocalDOMWindow::css() const
1568 { 1568 {
1569 if (!m_css) 1569 if (!m_css)
1570 m_css = DOMWindowCSS::create(); 1570 m_css = DOMWindowCSS::create();
1571 return m_css.get(); 1571 return m_css.get();
1572 } 1572 }
1573 1573
1574 static void didAddStorageEventListener(LocalDOMWindow* window)
1575 {
1576 // Creating these blink::Storage objects informs the system that we'd like t o receive
1577 // notifications about storage events that might be triggered in other proce sses. Rather
1578 // than subscribe to these notifications explicitly, we subscribe to them im plicitly to
1579 // simplify the work done by the system.
1580 window->localStorage(IGNORE_EXCEPTION);
1581 window->sessionStorage(IGNORE_EXCEPTION);
1582 }
1583
1584 bool LocalDOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr< EventListener> listener, bool useCapture) 1574 bool LocalDOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr< EventListener> listener, bool useCapture)
1585 { 1575 {
1586 if (!EventTarget::addEventListener(eventType, listener, useCapture)) 1576 if (!EventTarget::addEventListener(eventType, listener, useCapture))
1587 return false; 1577 return false;
1588 1578
1589 if (frame() && frame()->host()) 1579 if (frame() && frame()->host())
1590 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype); 1580 frame()->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype);
1591 1581
1592 if (Document* document = this->document()) { 1582 if (Document* document = this->document()) {
1593 document->addListenerTypeIfNeeded(eventType); 1583 document->addListenerTypeIfNeeded(eventType);
1594 if (eventType == EventTypeNames::storage)
1595 didAddStorageEventListener(this);
1596 } 1584 }
1597 1585
1598 lifecycleNotifier().notifyAddEventListener(this, eventType); 1586 lifecycleNotifier().notifyAddEventListener(this, eventType);
1599 1587
1600 if (eventType == EventTypeNames::unload) { 1588 if (eventType == EventTypeNames::unload) {
1601 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); 1589 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered);
1602 addUnloadEventListener(this); 1590 addUnloadEventListener(this);
1603 } else if (eventType == EventTypeNames::beforeunload) { 1591 } else if (eventType == EventTypeNames::beforeunload) {
1604 UseCounter::count(document(), UseCounter::DocumentBeforeUnloadRegistered ); 1592 UseCounter::count(document(), UseCounter::DocumentBeforeUnloadRegistered );
1605 if (allowsBeforeUnloadListeners(this)) { 1593 if (allowsBeforeUnloadListeners(this)) {
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 return m_frameObserver->frame(); 1969 return m_frameObserver->frame();
1982 } 1970 }
1983 1971
1984 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) 1972 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate)
1985 { 1973 {
1986 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. 1974 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8].
1987 return v8::Handle<v8::Object>(); 1975 return v8::Handle<v8::Object>();
1988 } 1976 }
1989 1977
1990 } // namespace blink 1978 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/storage/DOMWindowStorageController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698