Set up V8 bindings for extension/app APIs when they're first used, not on
context creation. This should gives us a significant reduction in extension/app
startup time and slightly better memory usage.

It also gives us better error messages, the chance to complete the 
implementation of API features, and eventually the ability to expose select
extension APIs (e.g. extension.sendMessage) to web pages.

Resubmitting: changes made to resubmit this patch reviewed in: https://codereview.chromium.org/12378077/

BUG=163678,120070,55316,177163
[email protected]

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=186643

Review URL: https://chromiumcodereview.appspot.com/11571014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187143 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/renderer/extensions/chrome_v8_context_set.cc b/chrome/renderer/extensions/chrome_v8_context_set.cc
index 0be3ece0..88f7f98 100644
--- a/chrome/renderer/extensions/chrome_v8_context_set.cc
+++ b/chrome/renderer/extensions/chrome_v8_context_set.cc
@@ -75,7 +75,7 @@
 
 void ChromeV8ContextSet::Remove(ChromeV8Context* context) {
   if (contexts_.erase(context)) {
-    context->clear_web_frame();
+    context->Invalidate();
     MessageLoop::current()->DeleteSoon(FROM_HERE, context);
   }
 }