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

Side by Side Diff: content/renderer/pepper/plugin_object.h

Issue 785213002: Cache function templates in PluginObject to avoid memory leak. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years 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 | « no previous file | content/renderer/pepper/plugin_object.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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CONTENT_RENDERER_PEPPER_PLUGIN_OBJECT_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_OBJECT_H_
6 #define CONTENT_RENDERER_PEPPER_PLUGIN_OBJECT_H_ 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_OBJECT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "gin/interceptor.h" 12 #include "gin/interceptor.h"
13 #include "gin/wrappable.h" 13 #include "gin/wrappable.h"
14 #include "ppapi/c/pp_var.h" 14 #include "ppapi/c/pp_var.h"
15 #include "v8/include/v8-util.h"
15 16
16 struct PPP_Class_Deprecated; 17 struct PPP_Class_Deprecated;
17 18
18 namespace gin { 19 namespace gin {
19 class Arguments; 20 class Arguments;
20 } // namespace gin 21 } // namespace gin
21 22
22 namespace content { 23 namespace content {
23 24
24 class PepperPluginInstanceImpl; 25 class PepperPluginInstanceImpl;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // gin::Wrappable 69 // gin::Wrappable
69 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( 70 gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
70 v8::Isolate* isolate) override; 71 v8::Isolate* isolate) override;
71 72
72 // Helper method to get named properties. 73 // Helper method to get named properties.
73 v8::Local<v8::Value> GetPropertyOrMethod(v8::Isolate* isolate, 74 v8::Local<v8::Value> GetPropertyOrMethod(v8::Isolate* isolate,
74 PP_Var identifier_var); 75 PP_Var identifier_var);
75 76
76 void Call(const std::string& identifier, gin::Arguments* args); 77 void Call(const std::string& identifier, gin::Arguments* args);
77 78
79 v8::Local<v8::FunctionTemplate> GetFunctionTemplate(v8::Isolate* isolate,
80 const std::string& name);
81
78 PepperPluginInstanceImpl* instance_; 82 PepperPluginInstanceImpl* instance_;
79 83
80 const PPP_Class_Deprecated* ppp_class_; 84 const PPP_Class_Deprecated* ppp_class_;
81 void* ppp_class_data_; 85 void* ppp_class_data_;
82 86
83 base::WeakPtrFactory<PluginObject> weak_factory_; 87 base::WeakPtrFactory<PluginObject> weak_factory_;
84 88
89 v8::StdPersistentValueMap<std::string, v8::FunctionTemplate> template_cache_;
90
85 DISALLOW_COPY_AND_ASSIGN(PluginObject); 91 DISALLOW_COPY_AND_ASSIGN(PluginObject);
86 }; 92 };
87 93
88 } // namespace content 94 } // namespace content
89 95
90 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_OBJECT_H_ 96 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/pepper/plugin_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698