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

Side by Side Diff: Source/core/inspector/ScriptArguments.cpp

Issue 325143002: Oilpan: Prepare moving inspector script related classes to oilpan. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed Created 6 years, 6 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/core/inspector/ScriptArguments.h ('k') | Source/core/inspector/ScriptCallStack.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) 2010 Google Inc. All rights reserved. 2 * Copyright (c) 2010 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 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/inspector/ScriptArguments.h" 32 #include "core/inspector/ScriptArguments.h"
33 33
34 #include "bindings/v8/ScriptValue.h" 34 #include "bindings/v8/ScriptValue.h"
35 #include "bindings/v8/V8Binding.h" 35 #include "bindings/v8/V8Binding.h"
36 #include <v8.h> 36 #include <v8.h>
37 37
38 namespace WebCore { 38 namespace WebCore {
39 39
40 PassRefPtr<ScriptArguments> ScriptArguments::create(ScriptState* scriptState, Ve ctor<ScriptValue>& arguments) 40 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ScriptArguments)
41
42 PassRefPtrWillBeRawPtr<ScriptArguments> ScriptArguments::create(ScriptState* scr iptState, Vector<ScriptValue>& arguments)
41 { 43 {
42 return adoptRef(new ScriptArguments(scriptState, arguments)); 44 return adoptRefWillBeNoop(new ScriptArguments(scriptState, arguments));
43 } 45 }
44 46
45 ScriptArguments::ScriptArguments(ScriptState* scriptState, Vector<ScriptValue>& arguments) 47 ScriptArguments::ScriptArguments(ScriptState* scriptState, Vector<ScriptValue>& arguments)
46 : m_scriptState(scriptState) 48 : m_scriptState(scriptState)
47 { 49 {
48 m_arguments.swap(arguments); 50 m_arguments.swap(arguments);
49 } 51 }
50 52
51 ScriptArguments::~ScriptArguments()
52 {
53 }
54
55 const ScriptValue &ScriptArguments::argumentAt(size_t index) const 53 const ScriptValue &ScriptArguments::argumentAt(size_t index) const
56 { 54 {
57 ASSERT(m_arguments.size() > index); 55 ASSERT(m_arguments.size() > index);
58 return m_arguments[index]; 56 return m_arguments[index];
59 } 57 }
60 58
61 bool ScriptArguments::getFirstArgumentAsString(String& result, bool checkForNull OrUndefined) 59 bool ScriptArguments::getFirstArgumentAsString(String& result, bool checkForNull OrUndefined)
62 { 60 {
63 if (!argumentCount()) 61 if (!argumentCount())
64 return false; 62 return false;
65 63
66 const ScriptValue& value = argumentAt(0); 64 const ScriptValue& value = argumentAt(0);
67 ScriptState::Scope scope(m_scriptState.get()); 65 ScriptState::Scope scope(m_scriptState.get());
68 if (checkForNullOrUndefined && (value.isNull() || value.isUndefined())) 66 if (checkForNullOrUndefined && (value.isNull() || value.isUndefined()))
69 return false; 67 return false;
70 68
71 // We intentionally ignore an exception that can be thrown in ToString(). 69 // We intentionally ignore an exception that can be thrown in ToString().
72 v8::TryCatch block; 70 v8::TryCatch block;
73 v8::Handle<v8::String> string = value.v8Value()->ToString(); 71 v8::Handle<v8::String> string = value.v8Value()->ToString();
74 result = string.IsEmpty() ? String() : toCoreString(string); 72 result = string.IsEmpty() ? String() : toCoreString(string);
75 return true; 73 return true;
76 } 74 }
77 75
78 } // namespace WebCore 76 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/ScriptArguments.h ('k') | Source/core/inspector/ScriptCallStack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698