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

Unified Diff: src/inspector/remote-object-id.cc

Issue 2467853003: [inspector] migrate Runtime to new style (Closed)
Patch Set: addressed comments Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/inspector/remote-object-id.h ('k') | src/inspector/string-util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/remote-object-id.cc
diff --git a/src/inspector/remote-object-id.cc b/src/inspector/remote-object-id.cc
index d83020c6f20208cc3115a0f57d931a53dad6e6b3..aac6724498da98dbd690aaf95d6e77ccefe7d0f6 100644
--- a/src/inspector/remote-object-id.cc
+++ b/src/inspector/remote-object-id.cc
@@ -27,44 +27,34 @@ RemoteObjectIdBase::parseInjectedScriptId(const String16& objectId) {
RemoteObjectId::RemoteObjectId() : RemoteObjectIdBase(), m_id(0) {}
-std::unique_ptr<RemoteObjectId> RemoteObjectId::parse(
- ErrorString* errorString, const String16& objectId) {
- std::unique_ptr<RemoteObjectId> result(new RemoteObjectId());
+Response RemoteObjectId::parse(const String16& objectId,
+ std::unique_ptr<RemoteObjectId>* result) {
+ std::unique_ptr<RemoteObjectId> remoteObjectId(new RemoteObjectId());
std::unique_ptr<protocol::DictionaryValue> parsedObjectId =
- result->parseInjectedScriptId(objectId);
- if (!parsedObjectId) {
- *errorString = "Invalid remote object id";
- return nullptr;
- }
+ remoteObjectId->parseInjectedScriptId(objectId);
+ if (!parsedObjectId) return Response::Error("Invalid remote object id");
- bool success = parsedObjectId->getInteger("id", &result->m_id);
- if (!success) {
- *errorString = "Invalid remote object id";
- return nullptr;
- }
- return result;
+ bool success = parsedObjectId->getInteger("id", &remoteObjectId->m_id);
+ if (!success) return Response::Error("Invalid remote object id");
+ *result = std::move(remoteObjectId);
+ return Response::OK();
}
RemoteCallFrameId::RemoteCallFrameId()
: RemoteObjectIdBase(), m_frameOrdinal(0) {}
-std::unique_ptr<RemoteCallFrameId> RemoteCallFrameId::parse(
- ErrorString* errorString, const String16& objectId) {
- std::unique_ptr<RemoteCallFrameId> result(new RemoteCallFrameId());
+Response RemoteCallFrameId::parse(const String16& objectId,
+ std::unique_ptr<RemoteCallFrameId>* result) {
+ std::unique_ptr<RemoteCallFrameId> remoteCallFrameId(new RemoteCallFrameId());
std::unique_ptr<protocol::DictionaryValue> parsedObjectId =
- result->parseInjectedScriptId(objectId);
- if (!parsedObjectId) {
- *errorString = "Invalid call frame id";
- return nullptr;
- }
+ remoteCallFrameId->parseInjectedScriptId(objectId);
+ if (!parsedObjectId) return Response::Error("Invalid call frame id");
- bool success = parsedObjectId->getInteger("ordinal", &result->m_frameOrdinal);
- if (!success) {
- *errorString = "Invalid call frame id";
- return nullptr;
- }
-
- return result;
+ bool success =
+ parsedObjectId->getInteger("ordinal", &remoteCallFrameId->m_frameOrdinal);
+ if (!success) return Response::Error("Invalid call frame id");
+ *result = std::move(remoteCallFrameId);
+ return Response::OK();
}
String16 RemoteCallFrameId::serialize(int injectedScriptId, int frameOrdinal) {
« no previous file with comments | « src/inspector/remote-object-id.h ('k') | src/inspector/string-util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698