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

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

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits 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
« no previous file with comments | « fpdfsdk/src/javascript/Field.cpp ('k') | fpdfsdk/src/javascript/JS_EventHandler.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_Context.h" 7 #include "JS_Context.h"
8 8
9 #include "JS_EventHandler.h" 9 #include "JS_EventHandler.h"
10 #include "JS_Runtime.h" 10 #include "JS_Runtime.h"
11 #include "fpdfsdk/include/javascript/IJavaScript.h" 11 #include "fpdfsdk/include/javascript/IJavaScript.h"
12 #include "resource.h" 12 #include "resource.h"
13 13
14 /* -------------------------- CJS_Context -------------------------- */ 14 /* -------------------------- CJS_Context -------------------------- */
15 15
16 CJS_Context::CJS_Context(CJS_Runtime* pRuntime) 16 CJS_Context::CJS_Context(CJS_Runtime* pRuntime)
17 : m_pRuntime(pRuntime), m_bBusy(FALSE), m_bMsgBoxEnable(TRUE) { 17 : m_pRuntime(pRuntime), m_bBusy(FALSE), m_bMsgBoxEnable(TRUE) {
18 m_pEventHandler = new CJS_EventHandler(this); 18 m_pEventHandler = new CJS_EventHandler(this);
19 } 19 }
20 20
21 CJS_Context::~CJS_Context() { 21 CJS_Context::~CJS_Context() {
22 delete m_pEventHandler; 22 delete m_pEventHandler;
23 } 23 }
24 24
25 CPDFSDK_Document* CJS_Context::GetReaderDocument() { 25 CPDFSDK_Document* CJS_Context::GetReaderDocument() {
26 return m_pRuntime->GetReaderDocument(); 26 return m_pRuntime->GetReaderDocument();
27 } 27 }
28 28
29 CPDFDoc_Environment* CJS_Context::GetReaderApp() { 29 CPDFDoc_Environment* CJS_Context::GetReaderApp() {
30 ASSERT(m_pRuntime != NULL);
31
32 return m_pRuntime->GetReaderApp(); 30 return m_pRuntime->GetReaderApp();
33 } 31 }
34 32
35 FX_BOOL CJS_Context::RunScript(const CFX_WideString& script, 33 FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
36 CFX_WideString* info) { 34 CFX_WideString* info) {
37 v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate()); 35 v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate());
38 v8::HandleScope handle_scope(m_pRuntime->GetIsolate()); 36 v8::HandleScope handle_scope(m_pRuntime->GetIsolate());
39 v8::Local<v8::Context> context = m_pRuntime->NewJSContext(); 37 v8::Local<v8::Context> context = m_pRuntime->NewJSContext();
40 v8::Context::Scope context_scope(context); 38 v8::Context::Scope context_scope(context);
41 39
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 272 }
275 273
276 void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) { 274 void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) {
277 m_pEventHandler->OnBatchExec(pTarget); 275 m_pEventHandler->OnBatchExec(pTarget);
278 } 276 }
279 277
280 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget, 278 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget,
281 const CFX_WideString& strTargetName) { 279 const CFX_WideString& strTargetName) {
282 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName); 280 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName);
283 } 281 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/Field.cpp ('k') | fpdfsdk/src/javascript/JS_EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698