| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 class LocalDOMWindow; | 36 class LocalDOMWindow; |
| 37 class LocalFrame; | 37 class LocalFrame; |
| 38 | 38 |
| 39 // ContextClient and ContextLifecycleObserver are helpers to associate an | 39 // ContextClient and ContextLifecycleObserver are helpers to associate an |
| 40 // object with an ExecutionContext. | 40 // object with an ExecutionContext. |
| 41 // | 41 // |
| 42 // - getExecutionContext() returns null after the context is detached. | 42 // - getExecutionContext() returns null after the context is detached. |
| 43 // - frame() is a syntax sugar for getExecutionContext()->frame(). It returns | 43 // - frame() is a syntax sugar for getExecutionContext()->frame(). It returns |
| 44 // null after the context is detached or the context is not a Document. | 44 // null after the context is detached or the context is not a Document. |
| 45 // |
| 46 // Both can safely be used up until destruction; i.e., unsafe to |
| 47 // call upon in a destructor. |
| 45 class CORE_EXPORT ContextClient : public GarbageCollectedMixin { | 48 class CORE_EXPORT ContextClient : public GarbageCollectedMixin { |
| 46 public: | 49 public: |
| 47 ExecutionContext* getExecutionContext() const; | 50 ExecutionContext* getExecutionContext() const; |
| 48 LocalFrame* frame() const; | 51 LocalFrame* frame() const; |
| 49 | 52 |
| 50 DECLARE_VIRTUAL_TRACE(); | 53 DECLARE_VIRTUAL_TRACE(); |
| 51 | 54 |
| 52 protected: | 55 protected: |
| 53 explicit ContextClient(ExecutionContext*); | 56 explicit ContextClient(ExecutionContext*); |
| 54 explicit ContextClient(LocalFrame*); | 57 explicit ContextClient(LocalFrame*); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 83 private: | 86 private: |
| 84 Type m_observerType; | 87 Type m_observerType; |
| 85 }; | 88 }; |
| 86 | 89 |
| 87 // DOMWindowClient is a helper to associate an object with a LocalDOMWindow. | 90 // DOMWindowClient is a helper to associate an object with a LocalDOMWindow. |
| 88 // | 91 // |
| 89 // - domWindow() returns null after the window is detached. | 92 // - domWindow() returns null after the window is detached. |
| 90 // - frame() is a syntax sugar for domWindow()->frame(). It returns | 93 // - frame() is a syntax sugar for domWindow()->frame(). It returns |
| 91 // null after the window is detached. | 94 // null after the window is detached. |
| 92 // | 95 // |
| 96 // Both can safely be used up until destruction; i.e., unsafe to |
| 97 // call upon in a destructor. |
| 98 // |
| 93 // If the object is a per-ExecutionContext thing, use ContextClient/ | 99 // If the object is a per-ExecutionContext thing, use ContextClient/ |
| 94 // ContextLifecycleObserver. If the object is a per-DOMWindow thing, use | 100 // ContextLifecycleObserver. If the object is a per-DOMWindow thing, use |
| 95 // DOMWindowClient. Basically, DOMWindowClient is expected to be used (only) | 101 // DOMWindowClient. Basically, DOMWindowClient is expected to be used (only) |
| 96 // for objects directly held by LocalDOMWindow. Other objects should use | 102 // for objects directly held by LocalDOMWindow. Other objects should use |
| 97 // ContextClient/ContextLifecycleObserver. | 103 // ContextClient/ContextLifecycleObserver. |
| 98 // | 104 // |
| 99 // There is a subtle difference between the timing when the context gets | 105 // There is a subtle difference between the timing when the context gets |
| 100 // detached and the timing when the window gets detached. In common cases, | 106 // detached and the timing when the window gets detached. In common cases, |
| 101 // these two happen at the same timing. The only exception is a case where | 107 // these two happen at the same timing. The only exception is a case where |
| 102 // a frame navigates from an initial empty document to another same-origin | 108 // a frame navigates from an initial empty document to another same-origin |
| (...skipping 11 matching lines...) Expand all Loading... |
| 114 explicit DOMWindowClient(LocalDOMWindow*); | 120 explicit DOMWindowClient(LocalDOMWindow*); |
| 115 explicit DOMWindowClient(LocalFrame*); | 121 explicit DOMWindowClient(LocalFrame*); |
| 116 | 122 |
| 117 private: | 123 private: |
| 118 WeakMember<LocalDOMWindow> m_domWindow; | 124 WeakMember<LocalDOMWindow> m_domWindow; |
| 119 }; | 125 }; |
| 120 | 126 |
| 121 } // namespace blink | 127 } // namespace blink |
| 122 | 128 |
| 123 #endif // ContextLifecycleObserver_h | 129 #endif // ContextLifecycleObserver_h |
| OLD | NEW |