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

Side by Side Diff: webkit/plugins/ppapi/resource_tracker_unittest.cc

Issue 7669055: Remove webkit::ppapi::Resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nulls auditeed Created 9 years, 4 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppapi_unittest.h" 5 #include "webkit/plugins/ppapi/ppapi_unittest.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "ppapi/c/pp_var.h" 8 #include "ppapi/c/pp_var.h"
9 #include "ppapi/c/ppp_instance.h" 9 #include "ppapi/c/ppp_instance.h"
10 #include "third_party/npapi/bindings/npruntime.h" 10 #include "third_party/npapi/bindings/npruntime.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
12 #include "webkit/plugins/ppapi/mock_plugin_delegate.h" 12 #include "webkit/plugins/ppapi/mock_plugin_delegate.h"
13 #include "webkit/plugins/ppapi/mock_resource.h" 13 #include "webkit/plugins/ppapi/mock_resource.h"
14 #include "webkit/plugins/ppapi/npapi_glue.h" 14 #include "webkit/plugins/ppapi/npapi_glue.h"
15 #include "webkit/plugins/ppapi/npobject_var.h" 15 #include "webkit/plugins/ppapi/npobject_var.h"
16 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 16 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
17 #include "webkit/plugins/ppapi/resource_tracker.h" 17 #include "webkit/plugins/ppapi/resource_tracker.h"
18 18
19 using ppapi::NPObjectVar; 19 using ppapi::NPObjectVar;
20 20
21 namespace webkit { 21 namespace webkit {
22 namespace ppapi { 22 namespace ppapi {
23 23
24 namespace { 24 namespace {
25 25
26 // Tracked Resources -----------------------------------------------------------
27
28 class TrackedMockResource : public MockResource {
29 public:
30 static int tracked_objects_alive;
31
32 TrackedMockResource(PluginInstance* instance) : MockResource(instance) {
33 tracked_objects_alive++;
34 }
35 ~TrackedMockResource() {
36 tracked_objects_alive--;
37 }
38 };
39
40 int TrackedMockResource::tracked_objects_alive = 0;
41
42 // Tracked NPObjects ----------------------------------------------------------- 26 // Tracked NPObjects -----------------------------------------------------------
43 27
44 int g_npobjects_alive = 0; 28 int g_npobjects_alive = 0;
45 29
46 void TrackedClassDeallocate(NPObject* npobject) { 30 void TrackedClassDeallocate(NPObject* npobject) {
47 g_npobjects_alive--; 31 g_npobjects_alive--;
48 delete npobject; 32 delete npobject;
49 } 33 }
50 34
51 NPClass g_tracked_npclass = { 35 NPClass g_tracked_npclass = {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 144
161 // Releasing the resource should free the internal ref, and so making a new 145 // Releasing the resource should free the internal ref, and so making a new
162 // one now should generate a new ID. 146 // one now should generate a new ID.
163 PP_Var pp_object3 = NPObjectToPPVar(instance(), npobject.get()); 147 PP_Var pp_object3 = NPObjectToPPVar(instance(), npobject.get());
164 EXPECT_NE(pp_object1.value.as_id, pp_object3.value.as_id); 148 EXPECT_NE(pp_object1.value.as_id, pp_object3.value.as_id);
165 var_tracker->ReleaseVar(static_cast<int32_t>(pp_object3.value.as_id)); 149 var_tracker->ReleaseVar(static_cast<int32_t>(pp_object3.value.as_id));
166 } 150 }
167 151
168 } // namespace ppapi 152 } // namespace ppapi
169 } // namespace webkit 153 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/resource_tracker.cc ('k') | webkit/plugins/ppapi/url_request_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698