Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 } | 49 } |
| 50 | 50 |
| 51 void WebDOMEvent::assign(const WebDOMEvent& other) | 51 void WebDOMEvent::assign(const WebDOMEvent& other) |
| 52 { | 52 { |
| 53 WebDOMEventPrivate* p = const_cast<WebDOMEventPrivate*>(other.m_private); | 53 WebDOMEventPrivate* p = const_cast<WebDOMEventPrivate*>(other.m_private); |
| 54 if (p) | 54 if (p) |
| 55 p->ref(); | 55 p->ref(); |
| 56 assign(p); | 56 assign(p); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void WebDOMEvent::assign(WebDOMEventPrivate* p) | 59 void WebDOMEvent::assign(WebDOMEventPrivate* event) |
| 60 { | 60 { |
| 61 // p is already ref'd for us by the caller | 61 // event is already ref'd for us by the caller |
| 62 if (m_private) | 62 if (m_private) |
| 63 m_private->deref(); | 63 m_private->deref(); |
|
abarth-chromium
2013/05/20 21:16:32
Ouch. We should remove this function. It's askin
dmichael (off chromium)
2013/05/23 16:47:00
Good point, I fixed it in a separate CL:
https://c
| |
| 64 m_private = p; | 64 m_private = event; |
| 65 } | |
| 66 | |
| 67 void WebDOMEvent::assign(const WTF::PassRefPtr<WebDOMEventPrivate>& event) | |
| 68 { | |
| 69 assign(event.leakRef()); | |
|
abarth-chromium
2013/05/20 21:16:32
Can't we just assign m_private directly? The raw
dmichael (off chromium)
2013/05/23 16:47:00
Done.
| |
| 65 } | 70 } |
| 66 | 71 |
| 67 WebDOMEvent::WebDOMEvent(const WTF::PassRefPtr<WebCore::Event>& event) | 72 WebDOMEvent::WebDOMEvent(const WTF::PassRefPtr<WebCore::Event>& event) |
| 68 : m_private(static_cast<WebDOMEventPrivate*>(event.leakRef())) | 73 : m_private(static_cast<WebDOMEventPrivate*>(event.leakRef())) |
| 69 { | 74 { |
| 70 } | 75 } |
| 71 | 76 |
| 72 WebDOMEvent::operator WTF::PassRefPtr<WebCore::Event>() const | 77 WebDOMEvent::operator WTF::PassRefPtr<WebCore::Event>() const |
| 73 { | 78 { |
| 74 return static_cast<WebCore::Event*>(m_private); | 79 return static_cast<WebCore::Event*>(m_private); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 return m_private->hasInterface(eventNames().interfaceForXMLHttpRequestProgre ssEvent); | 211 return m_private->hasInterface(eventNames().interfaceForXMLHttpRequestProgre ssEvent); |
| 207 } | 212 } |
| 208 | 213 |
| 209 bool WebDOMEvent::isBeforeLoadEvent() const | 214 bool WebDOMEvent::isBeforeLoadEvent() const |
| 210 { | 215 { |
| 211 ASSERT(m_private); | 216 ASSERT(m_private); |
| 212 return m_private->hasInterface(eventNames().interfaceForBeforeLoadEvent); | 217 return m_private->hasInterface(eventNames().interfaceForBeforeLoadEvent); |
| 213 } | 218 } |
| 214 | 219 |
| 215 } // namespace WebKit | 220 } // namespace WebKit |
| OLD | NEW |