| Index: extensions/renderer/script_context.h
|
| diff --git a/extensions/renderer/script_context.h b/extensions/renderer/script_context.h
|
| index b6c90f2c46f765723452a0450291768c6fc3ba6f..65b4a0d22a32b3b73ab1acf36740a0d3d90a3d8d 100644
|
| --- a/extensions/renderer/script_context.h
|
| +++ b/extensions/renderer/script_context.h
|
| @@ -6,8 +6,10 @@
|
| #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_
|
|
|
| #include <string>
|
| +#include <vector>
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/callback.h"
|
| #include "base/compiler_specific.h"
|
| #include "extensions/common/features/feature.h"
|
| #include "extensions/common/permissions/api_permission_set.h"
|
| @@ -45,9 +47,13 @@ class ScriptContext : public RequestSender::Source {
|
| // ModuleSystem.
|
| void Invalidate();
|
|
|
| + // Registers |closure| 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);
|
| +
|
| // Returns true if this context is still valid, false if it isn't.
|
| // A context becomes invalid via Invalidate().
|
| - bool is_valid() const { return !v8_context_.IsEmpty(); }
|
| + bool is_valid() const { return is_valid_; }
|
|
|
| v8::Handle<v8::Context> v8_context() const {
|
| return v8::Local<v8::Context>::New(isolate_, v8_context_);
|
| @@ -150,13 +156,15 @@ class ScriptContext : public RequestSender::Source {
|
| // extension.
|
| bool HasAPIPermission(APIPermission::ID permission) const;
|
|
|
| - protected:
|
| - // The v8 context the bindings are accessible to.
|
| - v8::Global<v8::Context> v8_context_;
|
| -
|
| private:
|
| class Runner;
|
|
|
| + // Whether this context is valid.
|
| + bool is_valid_;
|
| +
|
| + // The v8 context the bindings are accessible to.
|
| + v8::Global<v8::Context> v8_context_;
|
| +
|
| // The WebFrame associated with this context. This can be NULL because this
|
| // object can outlive is destroyed asynchronously.
|
| blink::WebFrame* web_frame_;
|
| @@ -185,6 +193,10 @@ class ScriptContext : public RequestSender::Source {
|
| // The set of capabilities granted to this context by extensions.
|
| APIPermissionSet content_capabilities_;
|
|
|
| + // A list of base::Closure instances as an observer interface for
|
| + // invalidation.
|
| + std::vector<base::Closure> invalidate_observers_;
|
| +
|
| v8::Isolate* isolate_;
|
|
|
| GURL url_;
|
|
|