Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: fpdfsdk/src/javascript/JS_Runtime.cpp

Issue 1473503002: Introduce "underlying types" to abstract XFA differences. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: rebase past Jun's CL. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698