Mark Object.observe as deprecated

Optimistically targetting M50 at the moment.

Note that V8 only calls out to Blink once per Object.observe call per realm, but
that seems to already match Blink's deprecation message behavior so I don't
believe any changes are required on the V8 side.

R=jochen@chromium.org
BUG=552100

Review URL: https://codereview.chromium.org/1566173003

Cr-Commit-Position: refs/heads/master@{#368364}
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
index 50e98e4..055380e 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
@@ -56,6 +56,7 @@
 static void useCounterCallback(v8::Isolate* isolate, v8::Isolate::UseCounterFeature feature)
 {
     UseCounter::Feature blinkFeature;
+    bool deprecated = false;
     switch (feature) {
     case v8::Isolate::kUseAsm:
         blinkFeature = UseCounter::UseAsm;
@@ -68,6 +69,7 @@
         break;
     case v8::Isolate::kObjectObserve:
         blinkFeature = UseCounter::ObjectObserve;
+        deprecated = true;
         break;
     case v8::Isolate::kSloppyMode:
         blinkFeature = UseCounter::V8SloppyMode;
@@ -89,7 +91,10 @@
         // does not know about. It's harmless.
         return;
     }
-    UseCounter::count(callingExecutionContext(isolate), blinkFeature);
+    if (deprecated)
+        UseCounter::countDeprecation(callingExecutionContext(isolate), blinkFeature);
+    else
+        UseCounter::count(callingExecutionContext(isolate), blinkFeature);
 }
 
 V8PerIsolateData::V8PerIsolateData()
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.cpp b/third_party/WebKit/Source/core/frame/UseCounter.cpp
index 0303cfa..8e65609f 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.cpp
+++ b/third_party/WebKit/Source/core/frame/UseCounter.cpp
@@ -974,6 +974,9 @@
     case RTCPeerConnectionCreateOfferLegacyNoFailureCallback:
         return "RTCPeerConnection.CreateOffer without a failure callback is deprecated. The failure callback will be a required parameter in M50. See https://www.chromestatus.com/feature/5663288008376320 for more details";
 
+    case ObjectObserve:
+        return willBeRemoved("'Object.observe'", 50, "6147094632988672");
+
     // Features that aren't deprecated don't have a deprecation message.
     default:
         return String();