Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.h

Issue 1880933002: Begin to enable extension APIs in Extension Service Worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments - 3 Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 22 matching lines...) Expand all
33 33
34 #include "bindings/core/v8/RejectedPromises.h" 34 #include "bindings/core/v8/RejectedPromises.h"
35 #include "bindings/core/v8/ScriptValue.h" 35 #include "bindings/core/v8/ScriptValue.h"
36 #include "bindings/core/v8/V8Binding.h" 36 #include "bindings/core/v8/V8Binding.h"
37 #include "bindings/core/v8/V8CacheOptions.h" 37 #include "bindings/core/v8/V8CacheOptions.h"
38 #include "core/CoreExport.h" 38 #include "core/CoreExport.h"
39 #include "platform/text/CompressibleString.h" 39 #include "platform/text/CompressibleString.h"
40 #include "wtf/Allocator.h" 40 #include "wtf/Allocator.h"
41 #include "wtf/OwnPtr.h" 41 #include "wtf/OwnPtr.h"
42 #include "wtf/ThreadingPrimitives.h" 42 #include "wtf/ThreadingPrimitives.h"
43 #include "wtf/Vector.h"
43 #include "wtf/text/TextPosition.h" 44 #include "wtf/text/TextPosition.h"
44 #include <v8.h> 45 #include <v8.h>
45 46
46 namespace blink { 47 namespace blink {
47 48
48 class CachedMetadataHandler; 49 class CachedMetadataHandler;
49 class ErrorEvent; 50 class ErrorEvent;
50 class ExceptionState; 51 class ExceptionState;
51 class ScriptSourceCode; 52 class ScriptSourceCode;
52 class WorkerOrWorkletGlobalScope; 53 class WorkerOrWorkletGlobalScope;
53 54
55 typedef WTF::Vector<v8::Extension*> V8Extensions;
yhirano 2016/04/22 02:28:10 Please use |using|.
56
54 class CORE_EXPORT WorkerOrWorkletScriptController : public GarbageCollectedFinal ized<WorkerOrWorkletScriptController> { 57 class CORE_EXPORT WorkerOrWorkletScriptController : public GarbageCollectedFinal ized<WorkerOrWorkletScriptController> {
55 WTF_MAKE_NONCOPYABLE(WorkerOrWorkletScriptController); 58 WTF_MAKE_NONCOPYABLE(WorkerOrWorkletScriptController);
56 public: 59 public:
57 static WorkerOrWorkletScriptController* create(WorkerOrWorkletGlobalScope*, v8::Isolate*); 60 static WorkerOrWorkletScriptController* create(WorkerOrWorkletGlobalScope*, v8::Isolate*);
61 static void registerExtensionIfNeeded(v8::Extension*);
58 virtual ~WorkerOrWorkletScriptController(); 62 virtual ~WorkerOrWorkletScriptController();
59 void dispose(); 63 void dispose();
60 64
61 bool isExecutionForbidden() const; 65 bool isExecutionForbidden() const;
62 bool isExecutionTerminating() const; 66 bool isExecutionTerminating() const;
63 67
64 // Returns true if the evaluation completed with no uncaught exception. 68 // Returns true if the evaluation completed with no uncaught exception.
65 bool evaluate(const ScriptSourceCode&, ErrorEvent** = nullptr, CachedMetadat aHandler* = nullptr, V8CacheOptions = V8CacheOptionsDefault); 69 bool evaluate(const ScriptSourceCode&, ErrorEvent** = nullptr, CachedMetadat aHandler* = nullptr, V8CacheOptions = V8CacheOptionsDefault);
66 70
67 // Prevents future JavaScript execution. See 71 // Prevents future JavaScript execution. See
(...skipping 21 matching lines...) Expand all
89 93
90 RejectedPromises* getRejectedPromises() const { return m_rejectedPromises.ge t(); } 94 RejectedPromises* getRejectedPromises() const { return m_rejectedPromises.ge t(); }
91 95
92 DECLARE_TRACE(); 96 DECLARE_TRACE();
93 97
94 bool isContextInitialized() const { return m_scriptState && !!m_scriptState- >perContextData(); } 98 bool isContextInitialized() const { return m_scriptState && !!m_scriptState- >perContextData(); }
95 99
96 private: 100 private:
97 WorkerOrWorkletScriptController(WorkerOrWorkletGlobalScope*, v8::Isolate*); 101 WorkerOrWorkletScriptController(WorkerOrWorkletGlobalScope*, v8::Isolate*);
98 class ExecutionState; 102 class ExecutionState;
103 static V8Extensions& registeredExtensions();
99 104
100 // Evaluate a script file in the current execution environment. 105 // Evaluate a script file in the current execution environment.
101 ScriptValue evaluate(const CompressibleString& script, const String& fileNam e, const TextPosition& scriptStartPosition, CachedMetadataHandler*, V8CacheOptio ns); 106 ScriptValue evaluate(const CompressibleString& script, const String& fileNam e, const TextPosition& scriptStartPosition, CachedMetadataHandler*, V8CacheOptio ns);
102 void disposeContextIfNeeded(); 107 void disposeContextIfNeeded();
103 108
104 Member<WorkerOrWorkletGlobalScope> m_globalScope; 109 Member<WorkerOrWorkletGlobalScope> m_globalScope;
105 110
106 // The v8 isolate associated to the (worker or worklet) global scope. For 111 // The v8 isolate associated to the (worker or worklet) global scope. For
107 // workers this should be the worker thread's isolate, while for worklets 112 // workers this should be the worker thread's isolate, while for worklets
108 // usually the main thread's isolate is used. 113 // usually the main thread's isolate is used.
(...skipping 13 matching lines...) Expand all
122 // returning. Hence kept as a bare pointer here, and not a Persistent with 127 // returning. Hence kept as a bare pointer here, and not a Persistent with
123 // Oilpan enabled; stack scanning will visit the object and 128 // Oilpan enabled; stack scanning will visit the object and
124 // trace its on-heap fields. 129 // trace its on-heap fields.
125 GC_PLUGIN_IGNORE("394615") 130 GC_PLUGIN_IGNORE("394615")
126 ExecutionState* m_executionState; 131 ExecutionState* m_executionState;
127 }; 132 };
128 133
129 } // namespace blink 134 } // namespace blink
130 135
131 #endif // WorkerOrWorkletScriptController_h 136 #endif // WorkerOrWorkletScriptController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698