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

Side by Side Diff: gin/interceptor_unittest.cc

Issue 1085733006: replace to be deprecated v8::PersistentValueMap with v8::GlobalValueMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « extensions/renderer/v8_schema_registry.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "gin/arguments.h" 6 #include "gin/arguments.h"
7 #include "gin/handle.h" 7 #include "gin/handle.h"
8 #include "gin/interceptor.h" 8 #include "gin/interceptor.h"
9 #include "gin/object_template_builder.h" 9 #include "gin/object_template_builder.h"
10 #include "gin/per_isolate_data.h" 10 #include "gin/per_isolate_data.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (!function_template.IsEmpty()) 111 if (!function_template.IsEmpty())
112 return function_template; 112 return function_template;
113 function_template = CreateFunctionTemplate( 113 function_template = CreateFunctionTemplate(
114 isolate, base::Bind(&MyInterceptor::Call), HolderIsFirstArgument); 114 isolate, base::Bind(&MyInterceptor::Call), HolderIsFirstArgument);
115 template_cache_.Set(name, function_template); 115 template_cache_.Set(name, function_template);
116 return function_template; 116 return function_template;
117 } 117 }
118 118
119 int value_; 119 int value_;
120 120
121 v8::StdPersistentValueMap<std::string, v8::FunctionTemplate> template_cache_; 121 v8::StdGlobalValueMap<std::string, v8::FunctionTemplate> template_cache_;
122 122
123 DISALLOW_COPY_AND_ASSIGN(MyInterceptor); 123 DISALLOW_COPY_AND_ASSIGN(MyInterceptor);
124 }; 124 };
125 125
126 WrapperInfo MyInterceptor::kWrapperInfo = {kEmbedderNativeGin}; 126 WrapperInfo MyInterceptor::kWrapperInfo = {kEmbedderNativeGin};
127 127
128 class InterceptorTest : public V8Test { 128 class InterceptorTest : public V8Test {
129 public: 129 public:
130 void RunInterceptorTest(const std::string& script_source) { 130 void RunInterceptorTest(const std::string& script_source) {
131 v8::Isolate* isolate = instance_->isolate(); 131 v8::Isolate* isolate = instance_->isolate();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 TEST_F(InterceptorTest, BypassInterceptorForbidden) { 187 TEST_F(InterceptorTest, BypassInterceptorForbidden) {
188 RunInterceptorTest( 188 RunInterceptorTest(
189 "(function (obj) {" 189 "(function (obj) {"
190 " obj.value = 191 /* make test happy */;" 190 " obj.value = 191 /* make test happy */;"
191 " obj[1] = 23;" 191 " obj[1] = 23;"
192 " if (obj[1] === 23) throw 'FAIL'; })"); 192 " if (obj[1] === 23) throw 'FAIL'; })");
193 } 193 }
194 194
195 } // namespace gin 195 } // namespace gin
OLDNEW
« no previous file with comments | « extensions/renderer/v8_schema_registry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698