Include base/timer/timer.h in the files that use it.
Gab, I've used your refactoring script for this, the rule is:
content = refactor_lib.ReadFile(file_path)
# Assume fwd-decls are correct in first pass.
if 'class OneShotTimer;' in content:
return False
if 'class RepeatingTimer;' in content:
return False
if 'class RetainingOneShotTimer;' in content:
return False
matches = re.compile(r'(\n *[^/\n][^/\n][^/\n]*base::(OneShotTimer|RepeatingTimer|RetainingOneShotTimer)\b[^*])', re.DOTALL).findall(content)
if not matches:
return False
found = False
for match in matches:
constant = 'YADAYADA'
match_mod = match[0].replace('OneShotTimer', constant).replace('RepeatingTimer', constant).replace('RetainingOneShotTimer', constant).replace('const ', '')
if not 'std::unique_ptr<base::%s' % constant in match_mod:
found = True
break
if not found:
return False
updated_content = refactor_lib.AddInclude(file_path, content, "base/timer/timer.h")
if updated_content == content:
return False
# Write updated file
refactor_lib.WriteFile(file_path, updated_content)
[email protected]
Change-Id: I5a6a19371e5d7dc864ce9c8ae117e9ee9d54dd80
Reviewed-on: https://chromium-review.googlesource.com/c/1435748
Reviewed-by: Sébastien Marchand <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Commit-Queue: Sébastien Marchand <[email protected]>
Cr-Commit-Position: refs/heads/master@{#626245}
diff --git a/components/gcm_driver/gcm_client_impl.h b/components/gcm_driver/gcm_client_impl.h
index d58742d9..18feb80 100644
--- a/components/gcm_driver/gcm_client_impl.h
+++ b/components/gcm_driver/gcm_client_impl.h
@@ -18,6 +18,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
+#include "base/timer/timer.h"
#include "components/gcm_driver/gcm_client.h"
#include "components/gcm_driver/gcm_stats_recorder_impl.h"
#include "google_apis/gcm/base/mcs_message.h"