Index: testing/embedder_test_shared_isolate_delegate.h |
diff --git a/testing/embedder_test_shared_isolate_delegate.h b/testing/embedder_test_shared_isolate_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..10a0d2d8657f5f5509acb846823172111a6d7973 |
--- /dev/null |
+++ b/testing/embedder_test_shared_isolate_delegate.h |
@@ -0,0 +1,35 @@ |
+// Copyright 2015 PDFium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef TESTING_EMBEDDER_TEST_SHARED_ISOLATE_DELEGATE_H_ |
+#define TESTING_EMBEDDER_TEST_SHARED_ISOLATE_DELEGATE_H_ |
+ |
+#include <map> |
+#include <utility> |
+ |
+#include "../fpdfsdk/include/jsapi/fxjs_v8.h" |
+#include "../third_party/base/nonstd_unique_ptr.h" |
+#include "embedder_test.h" |
+#include "embedder_test_timer_handling_delegate.h" |
+ |
+class EmbedderTestSharedIsolateDelegate |
+ : public EmbedderTestTimerHandlingDelegate { |
+ public: |
+ EmbedderTestSharedIsolateDelegate() |
+ : m_pArrayBufferAllocator(new FXJS_ArrayBufferAllocator) { |
+ v8::Isolate::CreateParams params; |
+ params.array_buffer_allocator = m_pArrayBufferAllocator.get(); |
+ m_pIsolate = v8::Isolate::New(params); |
+ } |
+ |
+ ~EmbedderTestSharedIsolateDelegate() { m_pIsolate->Dispose(); } |
+ |
+ v8::Isolate* GetSharedIsolate() const override { return m_pIsolate; } |
+ |
+ protected: |
+ nonstd::unique_ptr<FXJS_ArrayBufferAllocator> m_pArrayBufferAllocator; |
+ v8::Isolate* m_pIsolate; |
+}; |
+ |
+#endif // TESTING_EMBEDDER_TEST_SHARED_ISOLATE_DELEGATE_H_ |