Add support for Location (RTC_FROM_HERE) to ProcessThread::RegisterModule.
This makes a few things a lot clearer when looking at perf trace data:
* What module instances (where they were created) are called
* On what thread
* How frequently
* For how long
ProcessThread will be replaced by TaskQueue moving forward and this is a step towards understanding the behavior of the affected code.
BUG=webrtc:7219
Review-Url: https://codereview.webrtc.org/2729053002
Cr-Commit-Position: refs/heads/master@{#16998}
diff --git a/webrtc/modules/utility/source/process_thread_impl.h b/webrtc/modules/utility/source/process_thread_impl.h
index 510ab52..e07c3d7 100644
--- a/webrtc/modules/utility/source/process_thread_impl.h
+++ b/webrtc/modules/utility/source/process_thread_impl.h
@@ -16,6 +16,7 @@
#include <queue>
#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/location.h"
#include "webrtc/base/platform_thread.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/modules/utility/include/process_thread.h"
@@ -35,7 +36,7 @@
void WakeUp(Module* module) override;
void PostTask(std::unique_ptr<rtc::QueuedTask> task) override;
- void RegisterModule(Module* module) override;
+ void RegisterModule(Module* module, const rtc::Location& from) override;
void DeRegisterModule(Module* module) override;
protected:
@@ -44,16 +45,18 @@
private:
struct ModuleCallback {
- ModuleCallback() : module(nullptr), next_callback(0) {}
- ModuleCallback(const ModuleCallback& cb)
- : module(cb.module), next_callback(cb.next_callback) {}
- ModuleCallback(Module* module) : module(module), next_callback(0) {}
+ ModuleCallback() = delete;
+ ModuleCallback(ModuleCallback&& cb) = default;
+ ModuleCallback(const ModuleCallback& cb) = default;
+ ModuleCallback(Module* module, const rtc::Location& location)
+ : module(module), location(location) {}
bool operator==(const ModuleCallback& cb) const {
return cb.module == module;
}
Module* const module;
- int64_t next_callback; // Absolute timestamp.
+ int64_t next_callback = 0; // Absolute timestamp.
+ const rtc::Location location;
private:
ModuleCallback& operator=(ModuleCallback&);