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

Side by Side Diff: gin/handle.h

Issue 184253004: gin: Bug fix: Fix CreateHandle to return an emtpy handle in some extreme cases (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bug fix: remove an extra include Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | gin/wrappable.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium 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 GIN_HANDLE_H_ 5 #ifndef GIN_HANDLE_H_
6 #define GIN_HANDLE_H_ 6 #define GIN_HANDLE_H_
7 7
8 #include "gin/converter.h" 8 #include "gin/converter.h"
9 9
10 namespace gin { 10 namespace gin {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 *out = gin::Handle<T>(val, object); 54 *out = gin::Handle<T>(val, object);
55 return true; 55 return true;
56 } 56 }
57 }; 57 };
58 58
59 // This function is a convenient way to create a handle from a raw pointer 59 // This function is a convenient way to create a handle from a raw pointer
60 // without having to write out the type of the object explicitly. 60 // without having to write out the type of the object explicitly.
61 template<typename T> 61 template<typename T>
62 gin::Handle<T> CreateHandle(v8::Isolate* isolate, T* object) { 62 gin::Handle<T> CreateHandle(v8::Isolate* isolate, T* object) {
63 return gin::Handle<T>(object->GetWrapper(isolate), object); 63 v8::Handle<v8::Object> wrapper = object->GetWrapper(isolate);
64 if (wrapper.IsEmpty())
65 return gin::Handle<T>();
66 return gin::Handle<T>(wrapper, object);
64 } 67 }
65 68
66 } // namespace gin 69 } // namespace gin
67 70
68 #endif // GIN_HANDLE_H_ 71 #endif // GIN_HANDLE_H_
OLDNEW
« no previous file with comments | « no previous file | gin/wrappable.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698