Remove deperacated wrapper ExtensionAdapter
authorHalton Huo <halton.huo@intel.com>
Tue, 3 Jun 2014 10:26:30 +0000 (18:26 +0800)
committerHalton Huo <halton.huo@intel.com>
Wed, 11 Jun 2014 02:44:00 +0000 (10:44 +0800)
21 files changed:
application/application.gyp
bluetooth/bluetooth.gyp
bookmark/bookmark.gyp
callhistory/callhistory.gyp
common/common.gypi
common/extension_adapter.cc [deleted file]
common/extension_adapter.h [deleted file]
content/content.gyp
download/download.gyp
filesystem/filesystem.gyp
mediaserver/mediaserver.gyp
messageport/messageport.gyp
network_bearer_selection/network_bearer_selection.gyp
notification/notification.gyp
power/power.gyp
speech/speech.gyp
system_info/system_info.gyp
system_setting/system_setting.gyp
time/time.gyp
tizen/tizen.gyp
utils/utils.gyp

index 0cf4f5a..780dda2 100644 (file)
@@ -7,8 +7,6 @@
       'target_name': 'tizen_application',
       'type': 'loadable_module',
       'sources': [
-        '../common/extension.cc',
-        '../common/extension.h',
         'application.cc',
         'application.h',
         'application_api.js',
index 727cf34..b4db8b2 100644 (file)
@@ -17,8 +17,6 @@
         '../common/pkg-config.gypi',
       ],
       'sources': [
-        '../common/extension.cc',
-        '../common/extension.h',
         'bluetooth_api.js',
         'bluetooth_extension.cc',
         'bluetooth_extension.h',
index 8180881..20626bc 100644 (file)
@@ -15,8 +15,6 @@
         'bookmark_extension.h',
         'bookmark_instance.cc',
         'bookmark_instance.h',
-        '../common/extension.h',
-        '../common/extension.cc',
       ],
 
       # Evas.h is used in favorites.h.
index 1e2b33d..480e994 100644 (file)
@@ -23,8 +23,6 @@
             'callhistory.h',
             'callhistory_mobile.cc',
             'callhistory_props.h',
-            '../common/extension.cc',
-            '../common/extension.h',
           ],
         }],
       ],
index 7b5e045..1bd688b 100644 (file)
@@ -64,8 +64,8 @@
       '<(SHARED_INTERMEDIATE_DIR)',
     ],
     'sources': [
-      'extension_adapter.cc',
-      'extension_adapter.h',
+      'extension.cc',
+      'extension.h',
       'picojson.h',
       'utils.h',
       'XW_Extension.h',
diff --git a/common/extension_adapter.cc b/common/extension_adapter.cc
deleted file mode 100644 (file)
index 5f3efd5..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2013 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "common/extension_adapter.h"
-
-#include <iostream>
-#include "common/XW_Extension_EntryPoints.h"
-
-namespace {
-
-XW_Extension g_extension = 0;
-
-const XW_CoreInterface* g_core = NULL;
-const XW_MessagingInterface* g_messaging = NULL;
-const XW_Internal_SyncMessagingInterface* g_sync_messaging = NULL;
-const XW_Internal_EntryPointsInterface* g_entry_points = NULL;
-
-}  // namespace
-
-namespace internal {
-
-int32_t InitializeExtension(XW_Extension extension,
-                            XW_GetInterface get_interface,
-                            const char* name,
-                            const char* api,
-                            const char** entry_points,
-                            XW_CreatedInstanceCallback created,
-                            XW_DestroyedInstanceCallback destroyed,
-                            XW_HandleMessageCallback handle_message,
-                            XW_HandleSyncMessageCallback handle_sync_message) {
-  if (g_extension != 0) {
-    std::cerr << "Can't initialize same extension multiple times!\n";
-    return XW_ERROR;
-  }
-
-  g_extension = extension;
-
-  g_core = reinterpret_cast<const XW_CoreInterface*>(
-      get_interface(XW_CORE_INTERFACE));
-  if (!g_core) {
-    std::cerr << "Can't initialize extension: error getting Core interface.\n";
-    return XW_ERROR;
-  }
-  g_core->SetExtensionName(extension, name);
-  g_core->SetJavaScriptAPI(extension, api);
-  g_core->RegisterInstanceCallbacks(extension, created, destroyed);
-
-  g_messaging = reinterpret_cast<const XW_MessagingInterface*>(
-      get_interface(XW_MESSAGING_INTERFACE));
-  if (!g_messaging) {
-    std::cerr <<
-        "Can't initialize extension: error getting Messaging interface.\n";
-    return XW_ERROR;
-  }
-  g_messaging->Register(extension, handle_message);
-
-  g_sync_messaging =
-      reinterpret_cast<const XW_Internal_SyncMessagingInterface*>(
-          get_interface(XW_INTERNAL_SYNC_MESSAGING_INTERFACE));
-  if (!g_sync_messaging) {
-    std::cerr <<
-        "Can't initialize extension: error getting Messaging interface.\n";
-    return XW_ERROR;
-  }
-  g_sync_messaging->Register(extension, handle_sync_message);
-
-  g_entry_points = reinterpret_cast<const XW_Internal_EntryPointsInterface*>(
-      get_interface(XW_INTERNAL_ENTRY_POINTS_INTERFACE));
-  if (!g_entry_points) {
-    std::cerr << "NOTE: Entry points interface not available in this version "
-              << "of Crosswalk, ignoring entry point data for extensions.\n";
-  } else {
-    g_entry_points->SetExtraJSEntryPoints(extension, entry_points);
-  }
-
-  return XW_OK;
-}
-
-void PostMessage(XW_Instance instance, const char* message) {
-  g_messaging->PostMessage(instance, message);
-}
-
-void SetSyncReply(XW_Instance instance, const char* reply) {
-  g_sync_messaging->SetSyncReply(instance, reply);
-}
-
-}  // namespace internal
diff --git a/common/extension_adapter.h b/common/extension_adapter.h
deleted file mode 100644 (file)
index 651c3fa..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) 2013 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMMON_EXTENSION_ADAPTER_H_
-#define COMMON_EXTENSION_ADAPTER_H_
-
-#include <cstdlib>
-#include <map>
-#include "common/XW_Extension.h"
-#include "common/XW_Extension_SyncMessage.h"
-
-namespace internal {
-
-int32_t InitializeExtension(XW_Extension extension,
-                            XW_GetInterface get_interface,
-                            const char* name,
-                            const char* api,
-                            const char** entry_points,
-                            XW_CreatedInstanceCallback created,
-                            XW_DestroyedInstanceCallback destroyed,
-                            XW_HandleMessageCallback handle_message,
-                            XW_HandleSyncMessageCallback handle_sync_message);
-
-void PostMessage(XW_Instance instance, const char* message);
-void SetSyncReply(XW_Instance instance, const char* reply);
-
-}  // namespace internal
-
-class ContextAPI {
- public:
-  explicit ContextAPI(XW_Instance instance) : instance_(instance) {}
-
-  void PostMessage(const char* message) {
-    internal::PostMessage(instance_, message);
-  }
-  void SetSyncReply(const char* reply) {
-    internal::SetSyncReply(instance_, reply);
-  }
-
- private:
-  XW_Instance instance_;
-};
-
-template <class T>
-class ExtensionAdapter {
- public:
-  static int32_t Initialize(XW_Extension extension,
-                            XW_GetInterface get_interface);
-
- private:
-  static void DidCreateInstance(XW_Instance instance);
-  static void DidDestroyInstance(XW_Instance instance);
-
-  static void HandleMessage(XW_Instance instance, const char* message);
-  static void HandleSyncMessage(XW_Instance instance, const char* message);
-
-  typedef std::map<XW_Instance, T*> InstanceMap;
-  static InstanceMap g_instances;
-};
-
-template <class T>
-typename ExtensionAdapter<T>::InstanceMap ExtensionAdapter<T>::g_instances;
-
-template <class T>
-int32_t ExtensionAdapter<T>::Initialize(XW_Extension extension,
-                                        XW_GetInterface get_interface) {
-  return internal::InitializeExtension(
-      extension, get_interface, T::name, T::GetJavaScript(), T::entry_points,
-      DidCreateInstance, DidDestroyInstance, HandleMessage, HandleSyncMessage);
-}
-
-template <class T>
-void ExtensionAdapter<T>::DidCreateInstance(XW_Instance instance) {
-  g_instances[instance] = new T(new ContextAPI(instance));
-}
-
-template <class T>
-void ExtensionAdapter<T>::DidDestroyInstance(XW_Instance instance) {
-  delete g_instances[instance];
-  g_instances.erase(instance);
-}
-
-template <class T>
-void ExtensionAdapter<T>::HandleMessage(XW_Instance instance,
-                                        const char* message) {
-  g_instances[instance]->HandleMessage(message);
-}
-
-
-template <class T>
-void ExtensionAdapter<T>::HandleSyncMessage(XW_Instance instance,
-                                            const char* message) {
-  g_instances[instance]->HandleSyncMessage(message);
-}
-
-#define DEFINE_XWALK_EXTENSION(NAME)                                    \
-  int32_t XW_Initialize(XW_Extension extension,                         \
-                        XW_GetInterface get_interface) {                \
-    return ExtensionAdapter<NAME>::Initialize(extension, get_interface); \
-  }
-
-#endif  // COMMON_EXTENSION_ADAPTER_H_
index c6fcf71..1d6a63b 100644 (file)
@@ -19,8 +19,6 @@
         'content_filter.h',
         'content_instance.cc',
         'content_instance.h',
-        '../common/extension.cc',
-        '../common/extension.h',
       ],
       'includes': [
         '../common/pkg-config.gypi',
index 7c66428..9ef1cfb 100644 (file)
@@ -7,8 +7,6 @@
       'target_name': 'tizen_download',
       'type': 'loadable_module',
       'sources': [
-        '../common/extension.cc',
-        '../common/extension.h',
         'download_api.js',
         'download_extension.cc',
         'download_extension.h',
index 8efc984..0f711a3 100644 (file)
@@ -13,8 +13,6 @@
         ],
       },
       'sources': [
-        '../common/extension.cc',
-        '../common/extension.h',
         'filesystem_api.js',
         'filesystem_extension.cc',
         'filesystem_extension.h',
index 3ef371d..7c9b437 100644 (file)
@@ -28,8 +28,6 @@
         'mediaserver_instance.h',
         'mediaserver_manager.cc',
         'mediaserver_manager.h',
-        '../common/extension.cc',
-        '../common/extension.h',
       ],
       'includes': [
         '../common/pkg-config.gypi',
index 8ca1606..6488774 100644 (file)
@@ -21,8 +21,6 @@
         'messageport_extension.h',
         'messageport_instance.cc',
         'messageport_instance.h',
-        '../common/extension.cc',
-        '../common/extension.h',
       ],
     },
   ],
index 1e90327..38f6111 100644 (file)
@@ -7,8 +7,6 @@
       'target_name': 'tizen_network_bearer_selection',
       'type': 'loadable_module',
       'sources': [
-        '../common/extension.cc',
-        '../common/extension.h',
         'network_bearer_selection_api.js',
         'network_bearer_selection_connection_tizen.cc',
         'network_bearer_selection_connection_tizen.h',
index 5f9aa90..d4b3636 100644 (file)
@@ -23,8 +23,6 @@
         'notification_parameters.h',
         'picojson_helpers.cc',
         'picojson_helpers.h',
-        '../common/extension.h',
-        '../common/extension.cc',
       ],
 
       'conditions': [
index 5db284e..991e944 100644 (file)
@@ -17,8 +17,6 @@
         'power_instance_tizen.cc',
         'power_instance_tizen.h',
         'power_types.h',
-        '../common/extension.h',
-        '../common/extension.cc',
       ],
       'includes': [
         '../common/pkg-config.gypi',
index 897552e..95d5555 100644 (file)
@@ -28,8 +28,6 @@
         'speech_extension.h',
         'speech_instance.cc',
         'speech_instance.h',
-        '../common/extension.cc',
-        '../common/extension.h',        
       ],
     },
     {
index 3b77757..a6cb437 100644 (file)
         'system_info_wifi_network.h',
         'system_info_wifi_network_desktop.cc',
         'system_info_wifi_network_tizen.cc',
-        '../common/extension.cc',
-        '../common/extension.h',
       ],
     },
   ],
index b16d21a..fb95789 100644 (file)
@@ -14,8 +14,6 @@
         'system_setting_instance.h',
         'system_setting_instance_desktop.cc',
         'system_setting_instance_tizen.cc',
-        '../common/extension.h',
-        '../common/extension.cc',
       ],
       'conditions': [
         ['tizen == 1', {
index 651bff1..638ac5b 100644 (file)
@@ -20,8 +20,6 @@
         'time_extension.h',
         'time_instance.cc',
         'time_instance.h',
-        '../common/extension.h',
-        '../common/extension.cc',
       ],
       'conditions': [
         [ 'tizen == 1', {
index c434cff..fe811e8 100644 (file)
@@ -11,8 +11,6 @@
         'tizen_api.js',
         'tizen_extension.cc',
         'tizen_extension.h',
-        '../common/extension.cc',
-        '../common/extension.h',
       ],
     },
   ],
index 0133bf5..cb3480f 100644 (file)
@@ -10,8 +10,6 @@
         'utils_api.js',
         'utils_extension.cc',
         'utils_extension.h',
-        '../common/extension.cc',
-        '../common/extension.h',
       ],
     },
   ],