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

Side by Side Diff: trunk/src/chrome/renderer/extensions/v8_schema_registry.cc

Issue 23724028: Revert 222102 "Remove unsafe access hacks from ScopedPersistent." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | « trunk/src/chrome/renderer/extensions/scoped_persistent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // TODO(dcarney): Remove this when UnsafePersistent is removed. 5 // TODO(dcarney): Remove this when UnsafePersistent is removed.
6 #define V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR 6 #define V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
7 7
8 #include "chrome/renderer/extensions/v8_schema_registry.h" 8 #include "chrome/renderer/extensions/v8_schema_registry.h"
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 v8::Local<v8::Object> to_return = 101 v8::Local<v8::Object> to_return =
102 v8::Local<v8::Object>::New(isolate, v8_schema); 102 v8::Local<v8::Object>::New(isolate, v8_schema);
103 schema_cache_[api] = UnsafePersistent<v8::Object>(&v8_schema); 103 schema_cache_[api] = UnsafePersistent<v8::Object>(&v8_schema);
104 return handle_scope.Close(to_return); 104 return handle_scope.Close(to_return);
105 } 105 }
106 106
107 v8::Handle<v8::Context> V8SchemaRegistry::GetOrCreateContext( 107 v8::Handle<v8::Context> V8SchemaRegistry::GetOrCreateContext(
108 v8::Isolate* isolate) { 108 v8::Isolate* isolate) {
109 // It's ok to create local handles in this function, since this is only called 109 // It's ok to create local handles in this function, since this is only called
110 // when we have a HandleScope. 110 // when we have a HandleScope.
111 if (context_.IsEmpty()) { 111 if (context_.get().IsEmpty()) {
112 v8::Handle<v8::Context> context = v8::Context::New(isolate); 112 v8::Handle<v8::Context> context = v8::Context::New(isolate);
113 context_.reset(context); 113 context_.reset(context);
114 return context; 114 return context;
115 } 115 }
116 return context_.NewHandle(isolate); 116 return v8::Local<v8::Context>::New(isolate, context_.get());
117 } 117 }
118 118
119 } // namespace extensions 119 } // namespace extensions
OLDNEW
« no previous file with comments | « trunk/src/chrome/renderer/extensions/scoped_persistent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698