| 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 "Consts.h" | 9 #include "Consts.h" |
| 10 #include "Document.h" | 10 #include "Document.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 CJS_Runtime::~CJS_Runtime() { | 116 CJS_Runtime::~CJS_Runtime() { |
| 117 for (auto* obs : m_observers) | 117 for (auto* obs : m_observers) |
| 118 obs->OnDestroyed(); | 118 obs->OnDestroyed(); |
| 119 | 119 |
| 120 for (int i = 0, sz = m_ContextArray.GetSize(); i < sz; i++) | 120 for (int i = 0, sz = m_ContextArray.GetSize(); i < sz; i++) |
| 121 delete m_ContextArray.GetAt(i); | 121 delete m_ContextArray.GetAt(i); |
| 122 | 122 |
| 123 m_ContextArray.RemoveAll(); | 123 m_ContextArray.RemoveAll(); |
| 124 #ifndef PDF_ENABLE_XFA | |
| 125 FXJS_ReleaseRuntime(GetIsolate(), &m_context, &m_StaticObjects); | 124 FXJS_ReleaseRuntime(GetIsolate(), &m_context, &m_StaticObjects); |
| 126 #endif | |
| 127 | 125 |
| 128 m_pApp = NULL; | 126 m_pApp = NULL; |
| 129 m_pDocument = NULL; | 127 m_pDocument = NULL; |
| 130 m_context.Reset(); | 128 m_context.Reset(); |
| 131 | 129 |
| 132 if (m_isolateManaged) | 130 if (m_isolateManaged) |
| 133 m_isolate->Dispose(); | 131 m_isolate->Dispose(); |
| 134 } | 132 } |
| 135 | 133 |
| 136 void CJS_Runtime::DefineJSObjects() { | 134 void CJS_Runtime::DefineJSObjects() { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 #endif | 326 #endif |
| 329 void CJS_Runtime::AddObserver(Observer* observer) { | 327 void CJS_Runtime::AddObserver(Observer* observer) { |
| 330 ASSERT(!pdfium::ContainsKey(m_observers, observer)); | 328 ASSERT(!pdfium::ContainsKey(m_observers, observer)); |
| 331 m_observers.insert(observer); | 329 m_observers.insert(observer); |
| 332 } | 330 } |
| 333 | 331 |
| 334 void CJS_Runtime::RemoveObserver(Observer* observer) { | 332 void CJS_Runtime::RemoveObserver(Observer* observer) { |
| 335 ASSERT(pdfium::ContainsKey(m_observers, observer)); | 333 ASSERT(pdfium::ContainsKey(m_observers, observer)); |
| 336 m_observers.erase(observer); | 334 m_observers.erase(observer); |
| 337 } | 335 } |
| OLD | NEW |