Clean up observer's type in ScriptContext::AddInvalidationObserver

The observer is expected to be called at most/exactly once, so make
the observer type OnceClosure instead of (Repeating)Closure.

Bug: None
Test: None
Change-Id: I033ec5ac31b989d96944f5e68373ff1ef79604c7
Reviewed-on: https://chromium-review.googlesource.com/1244098
Reviewed-by: Devlin <[email protected]>
Commit-Queue: Istiaque Ahmed <[email protected]>
Cr-Commit-Position: refs/heads/master@{#594117}
diff --git a/extensions/renderer/script_context.h b/extensions/renderer/script_context.h
index 84e2bf6..f2ac3b89 100644
--- a/extensions/renderer/script_context.h
+++ b/extensions/renderer/script_context.h
@@ -70,7 +70,7 @@
 
   // Registers |observer| to be run when this context is invalidated. Closures
   // are run immediately when Invalidate() is called, not in a message loop.
-  void AddInvalidationObserver(const base::Closure& observer);
+  void AddInvalidationObserver(base::OnceClosure observer);
 
   // Returns true if this context is still valid, false if it isn't.
   // A context becomes invalid via Invalidate().
@@ -277,9 +277,9 @@
   // The set of capabilities granted to this context by extensions.
   APIPermissionSet content_capabilities_;
 
-  // A list of base::Closure instances as an observer interface for
+  // A list of base::OnceClosure instances as an observer interface for
   // invalidation.
-  std::vector<base::Closure> invalidate_observers_;
+  std::vector<base::OnceClosure> invalidate_observers_;
 
   v8::Isolate* isolate_;