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

Side by Side Diff: src/inspector/RemoteObjectId.cpp

Issue 2300823002: Revert of [inspector] Initial import of v8_inspector. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « src/inspector/RemoteObjectId.h ('k') | src/inspector/ScriptBreakpoint.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "src/inspector/RemoteObjectId.h"
6
7 #include "src/inspector/StringUtil.h"
8 #include "src/inspector/protocol/Protocol.h"
9
10 namespace v8_inspector {
11
12 RemoteObjectIdBase::RemoteObjectIdBase() : m_injectedScriptId(0) { }
13
14 std::unique_ptr<protocol::DictionaryValue> RemoteObjectIdBase::parseInjectedScri ptId(const String16& objectId)
15 {
16 std::unique_ptr<protocol::Value> parsedValue = protocol::parseJSON(objectId) ;
17 if (!parsedValue || parsedValue->type() != protocol::Value::TypeObject)
18 return nullptr;
19
20 std::unique_ptr<protocol::DictionaryValue> parsedObjectId(protocol::Dictiona ryValue::cast(parsedValue.release()));
21 bool success = parsedObjectId->getInteger("injectedScriptId", &m_injectedScr iptId);
22 if (success)
23 return parsedObjectId;
24 return nullptr;
25 }
26
27 RemoteObjectId::RemoteObjectId() : RemoteObjectIdBase(), m_id(0) { }
28
29 std::unique_ptr<RemoteObjectId> RemoteObjectId::parse(ErrorString* errorString, const String16& objectId)
30 {
31 std::unique_ptr<RemoteObjectId> result(new RemoteObjectId());
32 std::unique_ptr<protocol::DictionaryValue> parsedObjectId = result->parseInj ectedScriptId(objectId);
33 if (!parsedObjectId) {
34 *errorString = "Invalid remote object id";
35 return nullptr;
36 }
37
38 bool success = parsedObjectId->getInteger("id", &result->m_id);
39 if (!success) {
40 *errorString = "Invalid remote object id";
41 return nullptr;
42 }
43 return result;
44 }
45
46 RemoteCallFrameId::RemoteCallFrameId() : RemoteObjectIdBase(), m_frameOrdinal(0) { }
47
48 std::unique_ptr<RemoteCallFrameId> RemoteCallFrameId::parse(ErrorString* errorSt ring, const String16& objectId)
49 {
50 std::unique_ptr<RemoteCallFrameId> result(new RemoteCallFrameId());
51 std::unique_ptr<protocol::DictionaryValue> parsedObjectId = result->parseInj ectedScriptId(objectId);
52 if (!parsedObjectId) {
53 *errorString = "Invalid call frame id";
54 return nullptr;
55 }
56
57 bool success = parsedObjectId->getInteger("ordinal", &result->m_frameOrdinal );
58 if (!success) {
59 *errorString = "Invalid call frame id";
60 return nullptr;
61 }
62
63 return result;
64 }
65
66 String16 RemoteCallFrameId::serialize(int injectedScriptId, int frameOrdinal)
67 {
68 return "{\"ordinal\":" + String16::fromInteger(frameOrdinal) + ",\"injectedS criptId\":" + String16::fromInteger(injectedScriptId) + "}";
69 }
70
71 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/RemoteObjectId.h ('k') | src/inspector/ScriptBreakpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698