Avoid adding more than one root cbor namespace

There is already a ::cbor so creating a global ::cbor alias
to ::inspector_protocol::cbor caused problems in some non-default
jumbo builds. The code also uses variables named cbor so there
are many meanings of cbor.

Change-Id: I9a469d179b60783776510cea7167a63d873caaf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1578599
Commit-Queue: Daniel Bratell <bratell@opera.com>
Auto-Submit: Daniel Bratell <bratell@opera.com>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#653281}
diff --git a/content/browser/devtools/devtools_session.cc b/content/browser/devtools/devtools_session.cc
index cab390b..4dd2611 100644
--- a/content/browser/devtools/devtools_session.cc
+++ b/content/browser/devtools/devtools_session.cc
@@ -17,7 +17,6 @@
 #include "content/public/browser/devtools_manager_delegate.h"
 #include "third_party/inspector_protocol/encoding/encoding.h"
 
-namespace cbor = inspector_protocol_encoding::cbor;
 using inspector_protocol_encoding::SpanFrom;
 
 namespace content {
@@ -150,7 +149,8 @@
   // TODO(dgozman): revisit the proxy delegate.
   if (proxy_delegate_) {
     if (client_->UsesBinaryProtocol()) {
-      DCHECK(cbor::IsCBORMessage(SpanFrom(message)));
+      DCHECK(
+          inspector_protocol_encoding::cbor::IsCBORMessage(SpanFrom(message)));
       proxy_delegate_->SendMessageToBackend(
           this, ConvertCBORToJSON(SpanFrom(message)));
       return true;
@@ -168,7 +168,8 @@
     if (client_->UsesBinaryProtocol()) {
       // If the client uses the binary protocol, then |message| is already
       // CBOR (it comes from the client).
-      DCHECK(cbor::IsCBORMessage(SpanFrom(message)));
+      DCHECK(
+          inspector_protocol_encoding::cbor::IsCBORMessage(SpanFrom(message)));
     } else {
       converted_cbor_message = ConvertJSONToCBOR(SpanFrom(message));
       message_to_send = &converted_cbor_message;
@@ -288,7 +289,7 @@
     return;
   }
   std::string cbor = message->serialize(/*binary=*/true);
-  DCHECK(cbor::IsCBORMessage(SpanFrom(cbor)));
+  DCHECK(inspector_protocol_encoding::cbor::IsCBORMessage(SpanFrom(cbor)));
   client->DispatchProtocolMessage(
       agent_host,
       client->UsesBinaryProtocol() ? cbor : ConvertCBORToJSON(SpanFrom(cbor)));
@@ -329,7 +330,7 @@
   }
   std::string cbor(reinterpret_cast<const char*>(message->data.data()),
                    message->data.size());
-  DCHECK(cbor::IsCBORMessage(SpanFrom(cbor)));
+  DCHECK(inspector_protocol_encoding::cbor::IsCBORMessage(SpanFrom(cbor)));
   client->DispatchProtocolMessage(
       agent_host,
       client->UsesBinaryProtocol() ? cbor : ConvertCBORToJSON(SpanFrom(cbor)));
@@ -364,7 +365,8 @@
   // Or it comes from another devtools_session, in which case it may be CBOR
   // already. We auto-detect and convert to what the client wants as needed.
   inspector_protocol_encoding::span<uint8_t> bytes = SpanFrom(message);
-  bool is_cbor_message = cbor::IsCBORMessage(bytes);
+  bool is_cbor_message =
+      inspector_protocol_encoding::cbor::IsCBORMessage(bytes);
   if (client_->UsesBinaryProtocol()) {
     client_->DispatchProtocolMessage(
         agent_host_, is_cbor_message ? message : ConvertJSONToCBOR(bytes));
@@ -437,13 +439,14 @@
     // |this| may be deleted at this point.
     return;
   }
-  DCHECK(cbor::IsCBORMessage(SpanFrom(message)));
+  DCHECK(inspector_protocol_encoding::cbor::IsCBORMessage(SpanFrom(message)));
   std::string patched(message);
   inspector_protocol_encoding::Status status =
       inspector_protocol_encoding::cbor::AppendString8EntryToCBORMap(
           SpanFrom(kSessionId), SpanFrom(session_id), &patched);
   if (!status.ok()) {
-    LOG(ERROR) << "cbor::AppendString8EntryToCBORMap error "
+    LOG(ERROR) << "inspector_protocol_encoding::cbor::"
+                  "AppendString8EntryToCBORMap error "
                << static_cast<uint32_t>(status.error) << " position "
                << static_cast<uint32_t>(status.pos);
     return;