OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium 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 #include "platform/v8_inspector/RemoteObjectId.h" | 5 #include "platform/v8_inspector/RemoteObjectId.h" |
6 | 6 |
7 #include "platform/JSONParser.h" | 7 #include "platform/JSONParser.h" |
8 #include "platform/JSONValues.h" | 8 #include "platform/JSONValues.h" |
9 #include "wtf/PassOwnPtr.h" | 9 #include "wtf/PassOwnPtr.h" |
10 #include "wtf/RefPtr.h" | 10 #include "wtf/RefPtr.h" |
11 #include "wtf/text/WTFString.h" | 11 #include "wtf/text/WTFString.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 RemoteObjectIdBase::RemoteObjectIdBase() : m_injectedScriptId(0) { } | 15 RemoteObjectIdBase::RemoteObjectIdBase() : m_injectedScriptId(0) { } |
16 | 16 |
17 PassRefPtr<JSONObject> RemoteObjectIdBase::parseInjectedScriptId(const String& o
bjectId) | 17 PassRefPtr<JSONObject> RemoteObjectIdBase::parseInjectedScriptId(const String& o
bjectId) |
18 { | 18 { |
19 RefPtr<JSONValue> parsedValue = parseJSON(objectId); | 19 RefPtr<JSONValue> parsedValue = parseJSON(objectId); |
20 if (!parsedValue || parsedValue->type() != JSONValue::TypeObject) | 20 if (!parsedValue || parsedValue->type() != JSONValue::TypeObject) |
21 return nullptr; | 21 return nullptr; |
22 | 22 |
23 RefPtr<JSONObject> parsedObjectId = parsedValue->asObject(); | 23 RefPtr<JSONObject> parsedObjectId = JSONObject::cast(parsedValue.release()); |
24 bool success = parsedObjectId->getNumber("injectedScriptId", &m_injectedScri
ptId); | 24 bool success = parsedObjectId->getNumber("injectedScriptId", &m_injectedScri
ptId); |
25 if (success) | 25 if (success) |
26 return parsedObjectId.release(); | 26 return parsedObjectId.release(); |
27 return nullptr; | 27 return nullptr; |
28 } | 28 } |
29 | 29 |
30 RemoteObjectId::RemoteObjectId() : RemoteObjectIdBase(), m_id(0) { } | 30 RemoteObjectId::RemoteObjectId() : RemoteObjectIdBase(), m_id(0) { } |
31 | 31 |
32 PassOwnPtr<RemoteObjectId> RemoteObjectId::parse(const String& objectId) | 32 PassOwnPtr<RemoteObjectId> RemoteObjectId::parse(const String& objectId) |
33 { | 33 { |
(...skipping 21 matching lines...) Expand all Loading... |
55 if (!success) | 55 if (!success) |
56 return nullptr; | 56 return nullptr; |
57 | 57 |
58 RefPtr<JSONValue> value = parsedObjectId->get("asyncOrdinal"); | 58 RefPtr<JSONValue> value = parsedObjectId->get("asyncOrdinal"); |
59 if (value &&!value->asNumber(&result->m_asyncStackOrdinal)) | 59 if (value &&!value->asNumber(&result->m_asyncStackOrdinal)) |
60 return nullptr; | 60 return nullptr; |
61 return result.release(); | 61 return result.release(); |
62 } | 62 } |
63 | 63 |
64 } // namespace blink | 64 } // namespace blink |
OLD | NEW |