| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 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 22 matching lines...) Expand all Loading... |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 AXObjectCache::AXObjectCache() | 35 AXObjectCache::AXObjectCache() |
| 36 { | 36 { |
| 37 } | 37 } |
| 38 | 38 |
| 39 AXObjectCache::~AXObjectCache() | 39 AXObjectCache::~AXObjectCache() |
| 40 { | 40 { |
| 41 } | 41 } |
| 42 | 42 |
| 43 ScopedAXObjectCache::ScopedAXObjectCache(Document& document) |
| 44 : m_document(document) |
| 45 , m_cache(0) |
| 46 { |
| 47 if (AXObjectCache* existingCache = document.axObjectCache()) { |
| 48 m_cache = existingCache; |
| 49 m_isScoped = false; |
| 50 } else { |
| 51 m_isScoped = true; |
| 52 } |
| 53 } |
| 54 |
| 55 ScopedAXObjectCache::~ScopedAXObjectCache() |
| 56 { |
| 57 if (m_isScoped) |
| 58 delete m_cache; |
| 59 } |
| 60 |
| 61 AXObjectCache* ScopedAXObjectCache::get() |
| 62 { |
| 63 if (!m_cache && m_isScoped) |
| 64 m_cache = AXObjectCache::create(m_document); |
| 65 ASSERT(m_cache); |
| 66 return m_cache; |
| 67 } |
| 68 |
| 69 AXObjectCache* ScopedAXObjectCache::operator->() |
| 70 { |
| 71 return get(); |
| 72 } |
| 73 |
| 43 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |