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

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

Issue 2843603002: Move ScriptWrappable and dependencies to platform/bindings (Closed)
Patch Set: Rebase and try again Created 3 years, 7 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 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 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef V8ObjectConstructor_h 31 // This file has been moved to platform/bindings/V8ObjectConstructor.h.
32 #define V8ObjectConstructor_h 32 // TODO(adithyas): Remove this file.
33 33 #include "platform/bindings/V8ObjectConstructor.h"
34 #include "bindings/core/v8/V8PerIsolateData.h"
35 #include "core/CoreExport.h"
36 #include "platform/wtf/Allocator.h"
37 #include "v8/include/v8.h"
38
39 namespace blink {
40
41 class ConstructorMode {
42 STACK_ALLOCATED();
43
44 public:
45 enum Mode { kWrapExistingObject, kCreateNewObject };
46
47 ConstructorMode(v8::Isolate* isolate) : isolate_(isolate) {
48 V8PerIsolateData* data = V8PerIsolateData::From(isolate_);
49 previous_ = data->constructor_mode_;
50 data->constructor_mode_ = kWrapExistingObject;
51 }
52
53 ~ConstructorMode() {
54 V8PerIsolateData* data = V8PerIsolateData::From(isolate_);
55 data->constructor_mode_ = previous_;
56 }
57
58 static bool Current(v8::Isolate* isolate) {
59 return V8PerIsolateData::From(isolate)->constructor_mode_;
60 }
61
62 private:
63 v8::Isolate* isolate_;
64 bool previous_;
65 };
66
67 class CORE_EXPORT V8ObjectConstructor {
68 STATIC_ONLY(V8ObjectConstructor);
69
70 public:
71 static v8::MaybeLocal<v8::Object> NewInstance(
72 v8::Isolate*,
73 v8::Local<v8::Function>,
74 int argc = 0,
75 v8::Local<v8::Value> argv[] = nullptr);
76
77 static void IsValidConstructorMode(
78 const v8::FunctionCallbackInfo<v8::Value>&);
79 };
80
81 } // namespace blink
82
83 #endif // V8ObjectConstructor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698