'common/v8/node_common.h',
'common/v8/scoped_persistent.h',
'common/v8/native_type_conversions.h',
- 'common/v8_value_converter_impl.cc',
- 'common/v8_value_converter_impl.h',
+ 'common/v8/v8_value_converter.cc',
+ 'common/v8/v8_value_converter.h',
'renderer/api/atom_api_renderer_ipc.cc',
'renderer/api/atom_api_renderer_ipc.h',
'renderer/api/atom_renderer_bindings.cc',
#include "content/public/browser/render_view_host.h"
using content::RenderViewHost;
-using content::V8ValueConverter;
namespace atom {
v8::HandleScope handle_scope(node_isolate);
v8::Handle<v8::Context> context = v8::Context::GetCurrent();
- scoped_ptr<content::V8ValueConverter> converter(new V8ValueConverterImpl);
+ scoped_ptr<V8ValueConverter> converter(new V8ValueConverter);
v8::Handle<v8::Object> v8_event = Event::CreateV8Object();
Event* event = Event::Unwrap<Event>(v8_event);
#include "common/v8/node_common.h"
-using content::V8ValueConverter;
-
namespace atom {
AtomBrowserBindings::AtomBrowserBindings() {
const base::ListValue& args) {
v8::HandleScope handle_scope(node_isolate);
- scoped_ptr<V8ValueConverter> converter(new V8ValueConverterImpl());
+ scoped_ptr<V8ValueConverter> converter(new V8ValueConverter);
// process.emit(channel, 'message', process_id, routing_id);
std::vector<v8::Handle<v8::Value>> arguments;
IPC::Message* message) {
v8::HandleScope handle_scope(node_isolate);
- scoped_ptr<V8ValueConverter> converter(new V8ValueConverterImpl());
+ scoped_ptr<V8ValueConverter> converter(new V8ValueConverter);
// Create the event object.
v8::Handle<v8::Object> event = api::Event::CreateV8Object();
#include "browser/api/atom_api_window.h"
#include "common/swap_or_assign.h"
#include "common/v8/scoped_persistent.h"
-#include "common/v8_value_converter_impl.h"
+#include "common/v8/v8_value_converter.h"
#include "content/public/renderer/v8_value_converter.h"
#include "ui/gfx/rect.h"
#include "url/gurl.h"
}
operator scoped_ptr<base::Value>() {
- scoped_ptr<content::V8ValueConverter> converter(
- new atom::V8ValueConverterImpl);
+ scoped_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
return scoped_ptr<base::Value>(
converter->FromV8Value(value_, v8::Context::GetCurrent()));
}
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "common/v8_value_converter_impl.h"
+#include "common/v8/v8_value_converter.h"
#include <string>
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
-#include "v8/include/v8.h"
namespace atom {
-V8ValueConverterImpl::V8ValueConverterImpl()
+V8ValueConverter::V8ValueConverter()
: date_allowed_(false),
reg_exp_allowed_(false),
function_allowed_(false),
strip_null_from_objects_(false),
avoid_identity_hash_for_testing_(false) {}
-void V8ValueConverterImpl::SetDateAllowed(bool val) {
+void V8ValueConverter::SetDateAllowed(bool val) {
date_allowed_ = val;
}
-void V8ValueConverterImpl::SetRegExpAllowed(bool val) {
+void V8ValueConverter::SetRegExpAllowed(bool val) {
reg_exp_allowed_ = val;
}
-void V8ValueConverterImpl::SetFunctionAllowed(bool val) {
+void V8ValueConverter::SetFunctionAllowed(bool val) {
function_allowed_ = val;
}
-void V8ValueConverterImpl::SetStripNullFromObjects(bool val) {
+void V8ValueConverter::SetStripNullFromObjects(bool val) {
strip_null_from_objects_ = val;
}
-void V8ValueConverterImpl::SetStrategy(Strategy* strategy) {
- // Ignore any strategy.
-}
-
-v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Value(
+v8::Handle<v8::Value> V8ValueConverter::ToV8Value(
const base::Value* value, v8::Handle<v8::Context> context) const {
v8::Context::Scope context_scope(context);
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
return handle_scope.Close(ToV8ValueImpl(value));
}
-Value* V8ValueConverterImpl::FromV8Value(
+Value* V8ValueConverter::FromV8Value(
v8::Handle<v8::Value> val,
v8::Handle<v8::Context> context) const {
v8::Context::Scope context_scope(context);
return FromV8ValueImpl(val, &unique_map);
}
-v8::Handle<v8::Value> V8ValueConverterImpl::ToV8ValueImpl(
+v8::Handle<v8::Value> V8ValueConverter::ToV8ValueImpl(
const base::Value* value) const {
CHECK(value);
switch (value->GetType()) {
}
}
-v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Array(
+v8::Handle<v8::Value> V8ValueConverter::ToV8Array(
const base::ListValue* val) const {
v8::Handle<v8::Array> result(v8::Array::New(val->GetSize()));
return result;
}
-v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Object(
+v8::Handle<v8::Value> V8ValueConverter::ToV8Object(
const base::DictionaryValue* val) const {
v8::Handle<v8::Object> result(v8::Object::New());
return result;
}
-Value* V8ValueConverterImpl::FromV8ValueImpl(v8::Handle<v8::Value> val,
+Value* V8ValueConverter::FromV8ValueImpl(v8::Handle<v8::Value> val,
HashToHandleMap* unique_map) const {
CHECK(!val.IsEmpty());
return NULL;
}
-Value* V8ValueConverterImpl::FromV8Array(v8::Handle<v8::Array> val,
+Value* V8ValueConverter::FromV8Array(v8::Handle<v8::Array> val,
HashToHandleMap* unique_map) const {
if (!UpdateAndCheckUniqueness(unique_map, val))
return base::Value::CreateNullValue();
return result;
}
-Value* V8ValueConverterImpl::FromV8Object(
+Value* V8ValueConverter::FromV8Object(
v8::Handle<v8::Object> val,
HashToHandleMap* unique_map) const {
if (!UpdateAndCheckUniqueness(unique_map, val))
return result.release();
}
-bool V8ValueConverterImpl::UpdateAndCheckUniqueness(
+bool V8ValueConverter::UpdateAndCheckUniqueness(
HashToHandleMap* map,
v8::Handle<v8::Object> handle) const {
typedef HashToHandleMap::const_iterator Iterator;
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef ATOM_COMMON_V8_VALUE_CONVERTER_IMPL_H_
-#define ATOM_COMMON_V8_VALUE_CONVERTER_IMPL_H_
+#ifndef ATOM_COMMON_V8_V8_VALUE_CONVERTER_H_
+#define ATOM_COMMON_V8_V8_VALUE_CONVERTER_H_
#include <map>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "content/public/renderer/v8_value_converter.h"
+#include "v8/include/v8.h"
namespace base {
class BinaryValue;
namespace atom {
-// The content::V8ValueConverter depends on WebKit, we get rid of the WebKit
-// dependency by removing support of binary data.
-class V8ValueConverterImpl : public content::V8ValueConverter {
+class V8ValueConverter {
public:
- V8ValueConverterImpl();
-
- // V8ValueConverter implementation.
- virtual void SetDateAllowed(bool val) OVERRIDE;
- virtual void SetRegExpAllowed(bool val) OVERRIDE;
- virtual void SetFunctionAllowed(bool val) OVERRIDE;
- virtual void SetStripNullFromObjects(bool val) OVERRIDE;
- virtual void SetStrategy(Strategy* strategy) OVERRIDE;
- virtual v8::Handle<v8::Value> ToV8Value(
- const base::Value* value,
- v8::Handle<v8::Context> context) const OVERRIDE;
- virtual base::Value* FromV8Value(
- v8::Handle<v8::Value> value,
- v8::Handle<v8::Context> context) const OVERRIDE;
+ V8ValueConverter();
+
+ void SetDateAllowed(bool val);
+ void SetRegExpAllowed(bool val);
+ void SetFunctionAllowed(bool val);
+ void SetStripNullFromObjects(bool val);
+ v8::Handle<v8::Value> ToV8Value(const base::Value* value,
+ v8::Handle<v8::Context> context) const;
+ base::Value* FromV8Value(v8::Handle<v8::Value> value,
+ v8::Handle<v8::Context> context) const;
private:
- friend class ScopedAvoidIdentityHashForTesting;
typedef std::multimap<int, v8::Handle<v8::Object> > HashToHandleMap;
v8::Handle<v8::Value> ToV8ValueImpl(const base::Value* value) const;
bool avoid_identity_hash_for_testing_;
- DISALLOW_COPY_AND_ASSIGN(V8ValueConverterImpl);
+ DISALLOW_COPY_AND_ASSIGN(V8ValueConverter);
};
} // namespace atom
-#endif // ATOM_COMMON_V8_VALUE_CONVERTER_IMPL_H_
+#endif // ATOM_COMMON_V8_V8_VALUE_CONVERTER_H_
#include "common/v8/node_common.h"
-using content::V8ValueConverter;
-
namespace atom {
namespace {
v8::Context::Scope context_scope(context);
v8::Handle<v8::Object> process = GetProcessObject(context);
- scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create());
+ scoped_ptr<V8ValueConverter> converter(new V8ValueConverter);
std::vector<v8::Handle<v8::Value>> arguments;
arguments.reserve(1 + args.GetSize());