summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorrpaquay@chromium.org <rpaquay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-08 01:02:27 +0000
committerrpaquay@chromium.org <rpaquay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-08 01:02:27 +0000
commit73131fc196e42d57dbbe39ead9c974242d2d3be7 (patch)
treec149ea327ad419e2a87b7fece89f5967e8136f5e /extensions
parentb3fd32d3fc22b996f0bc5dd284331cc4bab156ff (diff)
downloadchromium_src-73131fc196e42d57dbbe39ead9c974242d2d3be7.zip
chromium_src-73131fc196e42d57dbbe39ead9c974242d2d3be7.tar.gz
chromium_src-73131fc196e42d57dbbe39ead9c974242d2d3be7.tar.bz2
* Replace "read" method with onReceiveXxx events.
* Few minor changes to idl file. * Socket implementation on Windows fully implemented and with (hopefully) correct threading usage. * ChromeOS and MacOS socket implementation empty for now (they will come in later CLs). BUG=336824,340363, 340413, 343651, 344081 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=262175 Review URL: https://codereview.chromium.org/180163009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262274 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions')
-rw-r--r--extensions/browser/api/api_resource_manager.h45
-rw-r--r--extensions/browser/api/async_api_function.h1
-rw-r--r--extensions/browser/extension_function_histogram_value.h4
3 files changed, 36 insertions, 14 deletions
diff --git a/extensions/browser/api/api_resource_manager.h b/extensions/browser/api/api_resource_manager.h
index 6374abe..e0c9b81 100644
--- a/extensions/browser/api/api_resource_manager.h
+++ b/extensions/browser/api/api_resource_manager.h
@@ -25,6 +25,8 @@
namespace extensions {
namespace api {
+class BluetoothSocketApiFunction;
+class BluetoothSocketEventDispatcher;
class SerialEventDispatcher;
}
@@ -152,6 +154,9 @@ class ApiResourceManager : public BrowserContextKeyedAPI,
private:
// TODO(rockot): ApiResourceData could be moved out of ApiResourceManager and
// we could avoid maintaining a friends list here.
+ friend class BluetoothAPI;
+ friend class api::BluetoothSocketApiFunction;
+ friend class api::BluetoothSocketEventDispatcher;
friend class api::SerialEventDispatcher;
friend class core_api::TCPServerSocketEventDispatcher;
friend class core_api::TCPSocketEventDispatcher;
@@ -215,26 +220,38 @@ class ApiResourceManager : public BrowserContextKeyedAPI,
}
void InitiateExtensionUnloadedCleanup(const std::string& extension_id) {
- content::BrowserThread::PostTask(
- thread_id_,
- FROM_HERE,
- base::Bind(&ApiResourceData::CleanupResourcesFromUnloadedExtension,
- this,
- extension_id));
+ if (content::BrowserThread::CurrentlyOn(thread_id_)) {
+ CleanupResourcesFromUnloadedExtension(extension_id);
+ } else {
+ content::BrowserThread::PostTask(
+ thread_id_,
+ FROM_HERE,
+ base::Bind(&ApiResourceData::CleanupResourcesFromUnloadedExtension,
+ this,
+ extension_id));
+ }
}
void InitiateExtensionSuspendedCleanup(const std::string& extension_id) {
- content::BrowserThread::PostTask(
- thread_id_,
- FROM_HERE,
- base::Bind(&ApiResourceData::CleanupResourcesFromSuspendedExtension,
- this,
- extension_id));
+ if (content::BrowserThread::CurrentlyOn(thread_id_)) {
+ CleanupResourcesFromSuspendedExtension(extension_id);
+ } else {
+ content::BrowserThread::PostTask(
+ thread_id_,
+ FROM_HERE,
+ base::Bind(&ApiResourceData::CleanupResourcesFromSuspendedExtension,
+ this,
+ extension_id));
+ }
}
void InititateCleanup() {
- content::BrowserThread::PostTask(
- thread_id_, FROM_HERE, base::Bind(&ApiResourceData::Cleanup, this));
+ if (content::BrowserThread::CurrentlyOn(thread_id_)) {
+ Cleanup();
+ } else {
+ content::BrowserThread::PostTask(
+ thread_id_, FROM_HERE, base::Bind(&ApiResourceData::Cleanup, this));
+ }
}
private:
diff --git a/extensions/browser/api/async_api_function.h b/extensions/browser/api/async_api_function.h
index dd4b500..b18ec4d 100644
--- a/extensions/browser/api/async_api_function.h
+++ b/extensions/browser/api/async_api_function.h
@@ -42,6 +42,7 @@ class AsyncApiFunction : public UIThreadExtensionFunction {
virtual bool RunImpl() OVERRIDE;
protected:
+ content::BrowserThread::ID work_thread_id() const { return work_thread_id_; }
void set_work_thread_id(content::BrowserThread::ID work_thread_id) {
work_thread_id_ = work_thread_id;
}
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h
index 17eee77..ec2a0ca 100644
--- a/extensions/browser/extension_function_histogram_value.h
+++ b/extensions/browser/extension_function_histogram_value.h
@@ -770,6 +770,10 @@ enum HistogramValue {
BLUETOOTHPRIVATE_SETPAIRINGRESPONSE,
NETWORKINGPRIVATE_GETCAPTIVEPORTALSTATUS,
AUTOMATIONINTERNAL_PERFORMACTION,
+ BLUETOOTH_UPDATE_SOCKET,
+ BLUETOOTH_SET_SOCKET_PAUSED,
+ BLUETOOTH_GET_SOCKET,
+ BLUETOOTH_GET_SOCKETS,
// Last entry: Add new entries above and ensure to update
// tools/metrics/histograms/histograms/histograms.xml.
ENUM_BOUNDARY