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

Side by Side Diff: fpdfsdk/javascript/JS_Runtime_Stub.cpp

Issue 2386273004: Add ptr_util.h from base until std::make_unique<> available (Closed)
Patch Set: 2016 Created 4 years, 2 months 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/fxedit/fxet_edit.cpp ('k') | fpdfsdk/pdfwindow/PWL_FontMap.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 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 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 <memory> 7 #include <memory>
8 8
9 #include "fpdfsdk/javascript/ijs_context.h" 9 #include "fpdfsdk/javascript/ijs_context.h"
10 #include "fpdfsdk/javascript/ijs_runtime.h" 10 #include "fpdfsdk/javascript/ijs_runtime.h"
11 #include "third_party/base/ptr_util.h"
11 12
12 class CJS_ContextStub final : public IJS_Context { 13 class CJS_ContextStub final : public IJS_Context {
13 public: 14 public:
14 CJS_ContextStub() {} 15 CJS_ContextStub() {}
15 ~CJS_ContextStub() override {} 16 ~CJS_ContextStub() override {}
16 17
17 // IJS_Context: 18 // IJS_Context:
18 FX_BOOL RunScript(const CFX_WideString& script, 19 FX_BOOL RunScript(const CFX_WideString& script,
19 CFX_WideString* info) override { 20 CFX_WideString* info) override {
20 return FALSE; 21 return FALSE;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void OnExternal_Exec() override {} 118 void OnExternal_Exec() override {}
118 }; 119 };
119 120
120 class CJS_RuntimeStub final : public IJS_Runtime { 121 class CJS_RuntimeStub final : public IJS_Runtime {
121 public: 122 public:
122 CJS_RuntimeStub() : m_pDoc(nullptr) {} 123 CJS_RuntimeStub() : m_pDoc(nullptr) {}
123 ~CJS_RuntimeStub() override {} 124 ~CJS_RuntimeStub() override {}
124 125
125 IJS_Context* NewContext() override { 126 IJS_Context* NewContext() override {
126 if (!m_pContext) 127 if (!m_pContext)
127 m_pContext = WrapUnique(new CJS_ContextStub()); 128 m_pContext = pdfium::MakeUnique<CJS_ContextStub>();
128 return GetCurrentContext(); 129 return GetCurrentContext();
129 } 130 }
130 131
131 IJS_Context* GetCurrentContext() override { return m_pContext.get(); } 132 IJS_Context* GetCurrentContext() override { return m_pContext.get(); }
132 void ReleaseContext(IJS_Context* pContext) override {} 133 void ReleaseContext(IJS_Context* pContext) override {}
133 134
134 void SetReaderDocument(CPDFSDK_Document* pReaderDoc) override { 135 void SetReaderDocument(CPDFSDK_Document* pReaderDoc) override {
135 m_pDoc = pReaderDoc; 136 m_pDoc = pReaderDoc;
136 } 137 }
137 CPDFSDK_Document* GetReaderDocument() override { return m_pDoc; } 138 CPDFSDK_Document* GetReaderDocument() override { return m_pDoc; }
(...skipping 21 matching lines...) Expand all
159 // static 160 // static
160 void IJS_Runtime::Initialize(unsigned int slot, void* isolate) {} 161 void IJS_Runtime::Initialize(unsigned int slot, void* isolate) {}
161 162
162 // static 163 // static
163 void IJS_Runtime::Destroy() {} 164 void IJS_Runtime::Destroy() {}
164 165
165 // static 166 // static
166 IJS_Runtime* IJS_Runtime::Create(CPDFSDK_Environment* pEnv) { 167 IJS_Runtime* IJS_Runtime::Create(CPDFSDK_Environment* pEnv) {
167 return new CJS_RuntimeStub; 168 return new CJS_RuntimeStub;
168 } 169 }
OLDNEW
« no previous file with comments | « fpdfsdk/fxedit/fxet_edit.cpp ('k') | fpdfsdk/pdfwindow/PWL_FontMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698