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

Side by Side Diff: tests/fake_browser_ppapi/fake_host.h

Issue 7292002: Remove plugin connection to PPAPI scriptable objects (var deprecated). Also (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 5 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 | « tests/fake_browser_ppapi/fake_file_ref.cc ('k') | tests/fake_browser_ppapi/fake_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 #ifndef NATIVE_CLIENT_TEST_FAKE_BROWSER_PPAPI_FAKE_HOST_H_
8 #define NATIVE_CLIENT_TEST_FAKE_BROWSER_PPAPI_FAKE_HOST_H_
9
10 #include <string.h>
11
12 #include <map>
13
14 #include "native_client/src/include/portability.h"
15 #include "native_client/tests/fake_browser_ppapi/fake_instance.h"
16 #include "native_client/tests/fake_browser_ppapi/fake_resource.h"
17 #include "ppapi/c/ppp.h"
18
19 struct PPB_Var_Deprecated;
20
21 namespace fake_browser_ppapi {
22
23 class Host {
24 public:
25 explicit Host(const char* plugin_file);
26 virtual ~Host();
27
28 // Implementations of the methods invoked by the browser.
29 int32_t InitializeModule(PP_Module module,
30 PPB_GetInterface get_intf);
31 void ShutdownModule();
32 virtual const void* GetInterface(const char* interface_name);
33
34 void set_var_deprecated_interface(const PPB_Var_Deprecated* var_interface) {
35 var_deprecated_interface_ = var_interface;
36 }
37 const PPB_Var_Deprecated* var_deprecated_interface() const {
38 return var_deprecated_interface_;
39 }
40
41 // Resource and Instance tracking.
42 //
43 // The host keeps track of all Resources and Instances assigning them a unique
44 // id. TrackResource/Instance() is to be called right after instantiation of a
45 // Resource/Instance. GetResource/Instance () can be called to map an id to a
46 // tracked Resource/Instance . If there is no such resource,
47 // Resource::Invalid() or Instance::Invalid() is returned.
48 //
49 // Resources and Instances are owned by the host - in other words, they will
50 // be deleted upon Host's destruction. Do not pass globals/stack variables
51 // to be tracked!
52 PP_Resource TrackResource(Resource* resource);
53 Resource* GetResource(PP_Resource resource_id);
54 PP_Instance TrackInstance(Instance* instance);
55 Instance* GetInstance(PP_Instance instance_id);
56
57 private:
58 typedef int32_t (*InitializeModuleFunc)(PP_Module module,
59 PPB_GetInterface get_intf);
60 typedef void (*ShutdownModuleFunc)();
61 typedef const void* (*GetInterfaceFunc)(const char* interface_name);
62
63 void* dl_handle_;
64 InitializeModuleFunc initialize_module_;
65 ShutdownModuleFunc shutdown_module_;
66 GetInterfaceFunc get_interface_;
67
68 const PPB_Var_Deprecated* var_deprecated_interface_;
69
70 // Resource tracking.
71 PP_Resource last_resource_id_; // Used and incremented for each new resource.
72 typedef std::map<PP_Resource, Resource*> ResourceMap;
73 ResourceMap resource_map_;
74
75 // Instance tracking.
76 PP_Instance last_instance_id_; // Used and incremented for each new instance.
77 typedef std::map<PP_Instance, Instance*> InstanceMap;
78 InstanceMap instance_map_;
79
80 NACL_DISALLOW_COPY_AND_ASSIGN(Host);
81 };
82
83 } // namespace fake_browser_ppapi
84
85 #endif // NATIVE_CLIENT_TEST_FAKE_BROWSER_PPAPI_FAKE_HOST_H_
OLDNEW
« no previous file with comments | « tests/fake_browser_ppapi/fake_file_ref.cc ('k') | tests/fake_browser_ppapi/fake_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698