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

Side by Side Diff: extensions/browser/api/hid/hid_device_manager.cc

Issue 780713002: Fix remaining WeakPtrFactory ordering problems (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/api/hid/hid_device_manager.h" 5 #include "extensions/browser/api/hid/hid_device_manager.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 const GetApiDevicesCallback& callback) 70 const GetApiDevicesCallback& callback)
71 : extension(extension), filters(filters), callback(callback) {} 71 : extension(extension), filters(filters), callback(callback) {}
72 ~GetApiDevicesParams() {} 72 ~GetApiDevicesParams() {}
73 73
74 const Extension* extension; 74 const Extension* extension;
75 std::vector<HidDeviceFilter> filters; 75 std::vector<HidDeviceFilter> filters;
76 GetApiDevicesCallback callback; 76 GetApiDevicesCallback callback;
77 }; 77 };
78 78
79 HidDeviceManager::HidDeviceManager(content::BrowserContext* context) 79 HidDeviceManager::HidDeviceManager(content::BrowserContext* context)
80 : weak_factory_(this), 80 : initialized_(false),
81 initialized_(false),
82 hid_service_observer_(this), 81 hid_service_observer_(this),
83 enumeration_ready_(false), 82 enumeration_ready_(false),
84 next_resource_id_(0) { 83 next_resource_id_(0),
84 weak_factory_(this) {
85 event_router_ = EventRouter::Get(context); 85 event_router_ = EventRouter::Get(context);
86 if (event_router_) { 86 if (event_router_) {
87 event_router_->RegisterObserver(this, hid::OnDeviceAdded::kEventName); 87 event_router_->RegisterObserver(this, hid::OnDeviceAdded::kEventName);
88 event_router_->RegisterObserver(this, hid::OnDeviceRemoved::kEventName); 88 event_router_->RegisterObserver(this, hid::OnDeviceRemoved::kEventName);
89 } 89 }
90 } 90 }
91 91
92 HidDeviceManager::~HidDeviceManager() { 92 HidDeviceManager::~HidDeviceManager() {
93 DCHECK(thread_checker_.CalledOnValidThread()); 93 DCHECK(thread_checker_.CalledOnValidThread());
94 } 94 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 void HidDeviceManager::DispatchEvent(const std::string& event_name, 281 void HidDeviceManager::DispatchEvent(const std::string& event_name,
282 scoped_ptr<base::ListValue> event_args, 282 scoped_ptr<base::ListValue> event_args,
283 const HidDeviceInfo& device_info) { 283 const HidDeviceInfo& device_info) {
284 scoped_ptr<Event> event(new Event(event_name, event_args.Pass())); 284 scoped_ptr<Event> event(new Event(event_name, event_args.Pass()));
285 event->will_dispatch_callback = 285 event->will_dispatch_callback =
286 base::Bind(&WillDispatchDeviceEvent, device_info); 286 base::Bind(&WillDispatchDeviceEvent, device_info);
287 event_router_->BroadcastEvent(event.Pass()); 287 event_router_->BroadcastEvent(event.Pass());
288 } 288 }
289 289
290 } // namespace extensions 290 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/hid/hid_device_manager.h ('k') | extensions/browser/api/serial/serial_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698