OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "JS_Runtime.h" | 7 #include "JS_Runtime.h" |
8 | 8 |
9 #include "../../../xfa/src/fxjse/src/value.h" | 9 #include "../../../xfa/src/fxjse/src/value.h" |
10 #include "../../include/fpdfxfa/fpdfxfa_app.h" | 10 #include "../../include/fpdfxfa/fpdfxfa_app.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 CJS_Context* pContext = (CJS_Context*)NewContext(); | 87 CJS_Context* pContext = (CJS_Context*)NewContext(); |
88 FXJS_InitializeRuntime(GetIsolate(), this, &m_context, &m_StaticObjects); | 88 FXJS_InitializeRuntime(GetIsolate(), this, &m_context, &m_StaticObjects); |
89 ReleaseContext(pContext); | 89 ReleaseContext(pContext); |
90 } | 90 } |
91 | 91 |
92 CJS_Runtime::~CJS_Runtime() { | 92 CJS_Runtime::~CJS_Runtime() { |
93 for (auto* obs : m_observers) | 93 for (auto* obs : m_observers) |
94 obs->OnDestroyed(); | 94 obs->OnDestroyed(); |
95 | 95 |
96 for (int i = 0; i < m_ContextArray.GetSize(); i++) | 96 for (int i = 0, sz = m_ContextArray.GetSize(); i < sz; i++) |
97 delete m_ContextArray.GetAt(i); | 97 delete m_ContextArray.GetAt(i); |
98 | 98 |
99 m_ContextArray.RemoveAll(); | 99 m_ContextArray.RemoveAll(); |
100 | 100 |
101 m_pApp = NULL; | 101 m_pApp = NULL; |
102 m_pDocument = NULL; | 102 m_pDocument = NULL; |
103 m_context.Reset(); | 103 m_context.Reset(); |
104 | 104 |
105 if (m_isolateManaged) | 105 if (m_isolateManaged) |
106 m_isolate->Dispose(); | 106 m_isolate->Dispose(); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 295 |
296 void CJS_Runtime::AddObserver(Observer* observer) { | 296 void CJS_Runtime::AddObserver(Observer* observer) { |
297 ASSERT(m_observers.find(observer) == m_observers.end()); | 297 ASSERT(m_observers.find(observer) == m_observers.end()); |
298 m_observers.insert(observer); | 298 m_observers.insert(observer); |
299 } | 299 } |
300 | 300 |
301 void CJS_Runtime::RemoveObserver(Observer* observer) { | 301 void CJS_Runtime::RemoveObserver(Observer* observer) { |
302 ASSERT(m_observers.find(observer) != m_observers.end()); | 302 ASSERT(m_observers.find(observer) != m_observers.end()); |
303 m_observers.erase(observer); | 303 m_observers.erase(observer); |
304 } | 304 } |
OLD | NEW |