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

Side by Side Diff: Source/bindings/v8/ScriptObject.cpp

Issue 293963003: Remove ScriptObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/ScriptObject.h ('k') | Source/bindings/v8/ScriptProfiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 #include "bindings/v8/ScriptObject.h" 32 #include "bindings/v8/ScriptObject.h"
33 33
34 #include "bindings/v8/ScriptState.h" 34 #include "bindings/v8/ScriptState.h"
35 35
36 #include "V8InspectorFrontendHost.h" 36 #include "V8InspectorFrontendHost.h"
37 37
38 #include <v8.h> 38 #include <v8.h>
39 39
40 namespace WebCore { 40 namespace WebCore {
41 41
42 ScriptObject::ScriptObject(ScriptState* scriptState, v8::Handle<v8::Object> v8Ob ject)
43 : ScriptValue(scriptState, v8Object)
44 , m_scriptState(scriptState)
45 {
46 }
47
48 ScriptObject::ScriptObject(ScriptState* scriptState, const ScriptValue& scriptVa lue)
49 : ScriptValue(scriptValue)
50 , m_scriptState(scriptState)
51 {
52 }
53
54 ScriptObject::ScriptObject()
55 : m_scriptState(nullptr)
56 {
57 }
58
59 ScriptObject::~ScriptObject()
60 {
61 }
62
63 v8::Handle<v8::Object> ScriptObject::v8Object() const
64 {
65 ASSERT(v8Value()->IsObject());
66 return v8::Handle<v8::Object>::Cast(v8Value());
67 }
68
69 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, Inspect orFrontendHost* value) 42 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, Inspect orFrontendHost* value)
70 { 43 {
71 ScriptState::Scope scope(scriptState); 44 ScriptState::Scope scope(scriptState);
72 v8::TryCatch tryCatch; 45 v8::TryCatch tryCatch;
73 scriptState->context()->Global()->Set(v8AtomicString(scriptState->isolate(), name), toV8(value, v8::Handle<v8::Object>(), scriptState->isolate())); 46 scriptState->context()->Global()->Set(v8AtomicString(scriptState->isolate(), name), toV8(value, v8::Handle<v8::Object>(), scriptState->isolate()));
74 return !tryCatch.HasCaught(); 47 return !tryCatch.HasCaught();
75 } 48 }
76 49
77 bool ScriptGlobalObject::get(ScriptState* scriptState, const char* name, ScriptO bject& value) 50 bool ScriptGlobalObject::get(ScriptState* scriptState, const char* name, ScriptV alue& value)
78 { 51 {
79 ScriptState::Scope scope(scriptState); 52 ScriptState::Scope scope(scriptState);
80 v8::Local<v8::Value> v8Value = scriptState->context()->Global()->Get(v8Atomi cString(scriptState->isolate(), name)); 53 v8::Local<v8::Value> v8Value = scriptState->context()->Global()->Get(v8Atomi cString(scriptState->isolate(), name));
81 if (v8Value.IsEmpty()) 54 if (v8Value.IsEmpty())
82 return false; 55 return false;
83 56
84 if (!v8Value->IsObject()) 57 if (!v8Value->IsObject())
85 return false; 58 return false;
86 59
87 value = ScriptObject(scriptState, v8::Handle<v8::Object>::Cast(v8Value)); 60 value = ScriptValue(scriptState, v8::Handle<v8::Object>::Cast(v8Value));
88 return true; 61 return true;
89 } 62 }
90 63
91 } // namespace WebCore 64 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptObject.h ('k') | Source/bindings/v8/ScriptProfiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698