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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 template<typename T> const T toConst() const | 106 template<typename T> const T toConst() const |
107 { | 107 { |
108 T res; | 108 T res; |
109 res.WebDOMEvent::assign(*this); | 109 res.WebDOMEvent::assign(*this); |
110 return res; | 110 return res; |
111 } | 111 } |
112 | 112 |
113 protected: | 113 protected: |
114 typedef WebCore::Event WebDOMEventPrivate; | 114 typedef WebCore::Event WebDOMEventPrivate; |
| 115 // assign() assumes that the given WebCore::Event has already had a |
| 116 // reference-count added by the caller. This WebDOMEvent takes ownership of |
| 117 // that ref-count. |
115 void assign(WebDOMEventPrivate*); | 118 void assign(WebDOMEventPrivate*); |
| 119 void assign(const WTF::PassRefPtr<WebDOMEventPrivate>&); |
116 WebDOMEventPrivate* m_private; | 120 WebDOMEventPrivate* m_private; |
117 | 121 |
118 template<typename T> T* unwrap() | 122 template<typename T> T* unwrap() |
119 { | 123 { |
120 return static_cast<T*>(m_private); | 124 return static_cast<T*>(m_private); |
121 } | 125 } |
122 | 126 |
123 template<typename T> const T* constUnwrap() const | 127 template<typename T> const T* constUnwrap() const |
124 { | 128 { |
125 return static_cast<const T*>(m_private); | 129 return static_cast<const T*>(m_private); |
126 } | 130 } |
127 }; | 131 }; |
128 | 132 |
129 } // namespace WebKit | 133 } // namespace WebKit |
130 | 134 |
131 #endif | 135 #endif |
OLD | NEW |