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 m_cache = AXObjectCache::create(m_document); |
| 53 } |
| 54 } |
| 55 |
| 56 ScopedAXObjectCache::~ScopedAXObjectCache() |
| 57 { |
| 58 if (m_isScoped) |
| 59 delete m_cache; |
| 60 } |
| 61 |
| 62 AXObjectCache* ScopedAXObjectCache::get() |
| 63 { |
| 64 ASSERT(m_cache); |
| 65 return m_cache; |
| 66 } |
| 67 |
| 68 AXObjectCache* ScopedAXObjectCache::operator->() |
| 69 { |
| 70 return get(); |
| 71 } |
| 72 |
43 } // namespace blink | 73 } // namespace blink |
OLD | NEW |