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

Side by Side Diff: src/handles.h

Issue 2622503002: include fixing: api.h shouldn't include objects-inl.h (Closed)
Patch Set: more arm Created 3 years, 11 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
« no previous file with comments | « src/global-handles.cc ('k') | src/i18n.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HANDLES_H_ 5 #ifndef V8_HANDLES_H_
6 #define V8_HANDLES_H_ 6 #define V8_HANDLES_H_
7 7
8 #include "include/v8.h" 8 #include "include/v8.h"
9 #include "src/base/functional.h" 9 #include "src/base/functional.h"
10 #include "src/base/macros.h" 10 #include "src/base/macros.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // 84 //
85 // Also note that Handles do not provide default equality comparison or hashing 85 // Also note that Handles do not provide default equality comparison or hashing
86 // operators on purpose. Such operators would be misleading, because intended 86 // operators on purpose. Such operators would be misleading, because intended
87 // semantics is ambiguous between Handle location and object identity. Instead 87 // semantics is ambiguous between Handle location and object identity. Instead
88 // use either {is_identical_to} or {location} explicitly. 88 // use either {is_identical_to} or {location} explicitly.
89 template <typename T> 89 template <typename T>
90 class Handle final : public HandleBase { 90 class Handle final : public HandleBase {
91 public: 91 public:
92 V8_INLINE explicit Handle(T** location = nullptr) 92 V8_INLINE explicit Handle(T** location = nullptr)
93 : HandleBase(reinterpret_cast<Object**>(location)) { 93 : HandleBase(reinterpret_cast<Object**>(location)) {
94 Object* a = nullptr; 94 // Type check:
95 T* b = nullptr; 95 DCHECK(T::IsObjectSubclass());
Michael Starzinger 2017/01/09 11:33:07 Are we allowed to use std::is_base_of (https://chr
marja 2017/01/09 11:48:36 Done.
96 a = b; // Fake assignment to enforce type checks.
97 USE(a);
98 } 96 }
97
99 V8_INLINE explicit Handle(T* object) : Handle(object, object->GetIsolate()) {} 98 V8_INLINE explicit Handle(T* object) : Handle(object, object->GetIsolate()) {}
100 V8_INLINE Handle(T* object, Isolate* isolate) : HandleBase(object, isolate) {} 99 V8_INLINE Handle(T* object, Isolate* isolate) : HandleBase(object, isolate) {}
101 100
102 // Allocate a new handle for the object, do not canonicalize. 101 // Allocate a new handle for the object, do not canonicalize.
103 V8_INLINE static Handle<T> New(T* object, Isolate* isolate); 102 V8_INLINE static Handle<T> New(T* object, Isolate* isolate);
104 103
105 // Constructor for handling automatic up casting. 104 // Constructor for handling automatic up casting.
106 // Ex. Handle<JSFunction> can be passed when Handle<Object> is expected. 105 // Ex. Handle<JSFunction> can be passed when Handle<Object> is expected.
107 template <typename S> 106 template <typename S>
108 V8_INLINE Handle(Handle<S> handle) 107 V8_INLINE Handle(Handle<S> handle)
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 next = limit = NULL; 412 next = limit = NULL;
414 sealed_level = level = 0; 413 sealed_level = level = 0;
415 canonical_scope = NULL; 414 canonical_scope = NULL;
416 } 415 }
417 }; 416 };
418 417
419 } // namespace internal 418 } // namespace internal
420 } // namespace v8 419 } // namespace v8
421 420
422 #endif // V8_HANDLES_H_ 421 #endif // V8_HANDLES_H_
OLDNEW
« no previous file with comments | « src/global-handles.cc ('k') | src/i18n.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698