Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 #include "modules/quota/DOMWindowQuota.h" | 31 #include "modules/quota/DOMWindowQuota.h" |
| 32 | 32 |
| 33 #include "core/frame/LocalDOMWindow.h" | 33 #include "core/frame/LocalDOMWindow.h" |
| 34 #include "core/frame/LocalFrame.h" | 34 #include "core/frame/LocalFrame.h" |
| 35 #include "modules/quota/DeprecatedStorageInfo.h" | 35 #include "modules/quota/DeprecatedStorageInfo.h" |
| 36 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 DOMWindowQuota::DOMWindowQuota(LocalDOMWindow& window) | 40 DOMWindowQuota::DOMWindowQuota(LocalDOMWindow& window) |
| 41 : ContextClient(window.frame()) {} | 41 : Supplement<LocalDOMWindow>(window) {} |
| 42 | 42 |
| 43 const char* DOMWindowQuota::supplementName() { | 43 const char* DOMWindowQuota::supplementName() { |
| 44 return "DOMWindowQuota"; | 44 return "DOMWindowQuota"; |
| 45 } | 45 } |
| 46 | 46 |
| 47 // static | 47 // static |
| 48 DOMWindowQuota& DOMWindowQuota::from(LocalDOMWindow& window) { | 48 DOMWindowQuota& DOMWindowQuota::from(LocalDOMWindow& window) { |
| 49 DOMWindowQuota* supplement = static_cast<DOMWindowQuota*>( | 49 DOMWindowQuota* supplement = static_cast<DOMWindowQuota*>( |
| 50 Supplement<LocalDOMWindow>::from(window, supplementName())); | 50 Supplement<LocalDOMWindow>::from(window, supplementName())); |
| 51 if (!supplement) { | 51 if (!supplement) { |
| 52 supplement = new DOMWindowQuota(window); | 52 supplement = new DOMWindowQuota(window); |
| 53 provideTo(window, supplementName(), supplement); | 53 provideTo(window, supplementName(), supplement); |
| 54 } | 54 } |
| 55 return *supplement; | 55 return *supplement; |
| 56 } | 56 } |
| 57 | 57 |
| 58 // static | 58 // static |
| 59 DeprecatedStorageInfo* DOMWindowQuota::webkitStorageInfo(DOMWindow& window) { | 59 DeprecatedStorageInfo* DOMWindowQuota::webkitStorageInfo(DOMWindow& window) { |
| 60 return DOMWindowQuota::from(toLocalDOMWindow(window)).webkitStorageInfo(); | 60 return DOMWindowQuota::from(toLocalDOMWindow(window)).webkitStorageInfo(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 DeprecatedStorageInfo* DOMWindowQuota::webkitStorageInfo() const { | 63 DeprecatedStorageInfo* DOMWindowQuota::webkitStorageInfo() const { |
| 64 if (!m_storageInfo && frame()) | 64 if (!m_storageInfo) |
|
haraken
2017/01/06 01:37:22
I don't think the frame check makes sense, so remo
sof
2017/01/06 07:25:49
Yes, same issue as https://codereview.chromium.org
| |
| 65 m_storageInfo = DeprecatedStorageInfo::create(); | 65 m_storageInfo = DeprecatedStorageInfo::create(); |
| 66 return m_storageInfo.get(); | 66 return m_storageInfo.get(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 DEFINE_TRACE(DOMWindowQuota) { | 69 DEFINE_TRACE(DOMWindowQuota) { |
| 70 visitor->trace(m_storageInfo); | 70 visitor->trace(m_storageInfo); |
| 71 Supplement<LocalDOMWindow>::trace(visitor); | 71 Supplement<LocalDOMWindow>::trace(visitor); |
| 72 ContextClient::trace(visitor); | |
| 73 } | 72 } |
| 74 | 73 |
| 75 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |