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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/RemoteObjectId.cpp

Issue 1728873002: DevTools: simplify JSONValues API, prepare to the OwnPtr migration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselines Created 4 years, 10 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
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698