| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include <X11/Intrinsic.h> | 45 #include <X11/Intrinsic.h> |
| 46 #include <gtk/gtk.h> | 46 #include <gtk/gtk.h> |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 | 49 |
| 50 #include <map> | 50 #include <map> |
| 51 #include <set> | 51 #include <set> |
| 52 #include <string> | 52 #include <string> |
| 53 #include <vector> | 53 #include <vector> |
| 54 #include "base/scoped_ptr.h" | 54 #include "base/scoped_ptr.h" |
| 55 #include "base/cross/std_hash.h" | 55 #include "base/hash_tables.h" |
| 56 #include "core/cross/display_mode.h" | 56 #include "core/cross/display_mode.h" |
| 57 #include "core/cross/display_window.h" | 57 #include "core/cross/display_window.h" |
| 58 #include "core/cross/object_base.h" | 58 #include "core/cross/object_base.h" |
| 59 #include "core/cross/service_locator.h" | 59 #include "core/cross/service_locator.h" |
| 60 #include "core/cross/evaluation_counter.h" | 60 #include "core/cross/evaluation_counter.h" |
| 61 #include "core/cross/class_manager.h" | 61 #include "core/cross/class_manager.h" |
| 62 #include "core/cross/client_info.h" | 62 #include "core/cross/client_info.h" |
| 63 #include "core/cross/cursor.h" | 63 #include "core/cross/cursor.h" |
| 64 #include "core/cross/features.h" | 64 #include "core/cross/features.h" |
| 65 #include "core/cross/object_manager.h" | 65 #include "core/cross/object_manager.h" |
| 66 #include "core/cross/error.h" | 66 #include "core/cross/error.h" |
| 67 #include "core/cross/profiler.h" | 67 #include "core/cross/profiler.h" |
| 68 #include "plugin/cross/main_thread_task_poster.h" | 68 #include "plugin/cross/main_thread_task_poster.h" |
| 69 #include "plugin/cross/np_v8_bridge.h" | 69 #include "plugin/cross/np_v8_bridge.h" |
| 70 #include "client_glue.h" | 70 #include "client_glue.h" |
| 71 #include "third_party/nixysa/static_glue/npapi/common.h" | 71 #include "third_party/nixysa/static_glue/npapi/common.h" |
| 72 | 72 |
| 73 namespace o3d { | 73 namespace o3d { |
| 74 class Client; | 74 class Client; |
| 75 class Renderer; | 75 class Renderer; |
| 76 } | 76 } |
| 77 | 77 |
| 78 // Hashes the NPClass and ObjectBase types so they can be used in a hash_map. |
| 79 #if defined(COMPILER_GCC) |
| 80 namespace __gnu_cxx { |
| 81 |
| 82 template<> |
| 83 struct hash<NPClass*> { |
| 84 std::size_t operator()(NPClass* const& ptr) const { |
| 85 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
| 86 } |
| 87 }; |
| 88 |
| 89 template<> |
| 90 struct hash<const o3d::ObjectBase::Class*> { |
| 91 std::size_t operator()(const o3d::ObjectBase::Class* const& ptr) const { |
| 92 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
| 93 } |
| 94 }; |
| 95 |
| 96 } // namespace __gnu_cxx |
| 97 #elif defined(COMPILER_MSVC) |
| 98 namespace stdext { |
| 99 |
| 100 template<> |
| 101 inline size_t hash_value(NPClass* const& ptr) { |
| 102 return hash_value(reinterpret_cast<size_t>(ptr)); |
| 103 } |
| 104 |
| 105 template<> |
| 106 inline size_t hash_value(const o3d::ObjectBase::Class* const& ptr) { |
| 107 return hash_value(reinterpret_cast<size_t>(ptr)); |
| 108 } |
| 109 |
| 110 } // namespace stdext |
| 111 #endif // COMPILER |
| 112 |
| 78 namespace glue { | 113 namespace glue { |
| 79 class StreamManager; | 114 class StreamManager; |
| 80 | 115 |
| 81 namespace _o3d { | 116 namespace _o3d { |
| 82 using o3d::Id; | 117 using o3d::Id; |
| 83 using o3d::ObjectBase; | 118 using o3d::ObjectBase; |
| 84 using o3d::Client; | 119 using o3d::Client; |
| 85 using o3d::ClassManager; | 120 using o3d::ClassManager; |
| 86 using o3d::ClientInfoManager; | 121 using o3d::ClientInfoManager; |
| 87 using o3d::EvaluationCounter; | 122 using o3d::EvaluationCounter; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 112 NPAPIObject *GetNPObject(NPP npp, ObjectBase *object); | 147 NPAPIObject *GetNPObject(NPP npp, ObjectBase *object); |
| 113 NPObject *Allocate(NPP npp, NPClass *npclass); | 148 NPObject *Allocate(NPP npp, NPClass *npclass); |
| 114 void Deallocate(NPObject *object); | 149 void Deallocate(NPObject *object); |
| 115 ServiceLocator *GetServiceLocator(NPP npp); | 150 ServiceLocator *GetServiceLocator(NPP npp); |
| 116 Client *GetClient(NPP npp); | 151 Client *GetClient(NPP npp); |
| 117 void InitializeGlue(NPP npp); | 152 void InitializeGlue(NPP npp); |
| 118 | 153 |
| 119 typedef glue::namespace_o3d::class_Client::NPAPIObject ClientNPObject; | 154 typedef glue::namespace_o3d::class_Client::NPAPIObject ClientNPObject; |
| 120 | 155 |
| 121 class PluginObject: public NPObject { | 156 class PluginObject: public NPObject { |
| 122 typedef o3d::base::hash_map<Id, NPAPIObject *> ClientObjectMap; | 157 typedef ::base::hash_map<Id, NPAPIObject *> ClientObjectMap; |
| 123 typedef o3d::base::hash_map<const ObjectBase::Class *, NPClass *> | 158 typedef ::base::hash_map<const ObjectBase::Class *, NPClass *> |
| 124 ClientToNPClassMap; | 159 ClientToNPClassMap; |
| 125 typedef o3d::base::hash_map<NPClass *, const ObjectBase::Class *> | 160 typedef ::base::hash_map<NPClass *, const ObjectBase::Class *> |
| 126 NPToClientClassMap; | 161 NPToClientClassMap; |
| 127 | 162 |
| 128 NPP npp_; | 163 NPP npp_; |
| 129 ServiceLocator service_locator_; | 164 ServiceLocator service_locator_; |
| 130 EvaluationCounter evaluation_counter_; | 165 EvaluationCounter evaluation_counter_; |
| 131 ClassManager class_manager_; | 166 ClassManager class_manager_; |
| 132 ClientInfoManager client_info_manager_; | 167 ClientInfoManager client_info_manager_; |
| 133 ObjectManager object_manager_; | 168 ObjectManager object_manager_; |
| 134 Profiler profiler_; | 169 Profiler profiler_; |
| 135 MainThreadTaskPoster main_thread_task_poster_; | 170 MainThreadTaskPoster main_thread_task_poster_; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 HCURSOR hCursor_; | 461 HCURSOR hCursor_; |
| 427 bool painted_once_; | 462 bool painted_once_; |
| 428 #endif // OS_WIN | 463 #endif // OS_WIN |
| 429 }; | 464 }; |
| 430 | 465 |
| 431 } // namespace o3d | 466 } // namespace o3d |
| 432 } // namespace glue | 467 } // namespace glue |
| 433 | 468 |
| 434 | 469 |
| 435 #endif // O3D_PLUGIN_CROSS_O3D_GLUE_H_ | 470 #endif // O3D_PLUGIN_CROSS_O3D_GLUE_H_ |
| OLD | NEW |