Use SessionIDs by value instead of underlying type
No behavioral changes: we start a migration in SessionID's API to better
control their lifetime and avoid collisions. We now encourage client
code to pass SessionID instances by value and only rarely use
SessionID::id_type.
As a first example, sync codebase is migrated to the new API. A lot more
occurrences exist beyond sync, and will be addressed in follow-up
patches.
The new API also introduces the notion of invalid session IDs, which is
internally represented as -1: we do this because it's very common
throughout the codebase, and it seems preferrable to provide this
functionality on the SessionID class itself.
Bug: 823798
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I3516f6f49068b2102b780824dea90135c010e42c
Reviewed-on: https://chromium-review.googlesource.com/972041
Reviewed-by: Karan Bhatia <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Rohit Rao <[email protected]>
Reviewed-by: Bernhard Bauer <[email protected]>
Commit-Queue: Mikel Astiz <[email protected]>
Cr-Commit-Position: refs/heads/master@{#546434}
diff --git a/chrome/browser/ui/browser_live_tab_context.h b/chrome/browser/ui/browser_live_tab_context.h
index 8e7bf16..6d5b5ec 100644
--- a/chrome/browser/ui/browser_live_tab_context.h
+++ b/chrome/browser/ui/browser_live_tab_context.h
@@ -33,7 +33,7 @@
// Overridden from LiveTabContext:
void ShowBrowserWindow() override;
- const SessionID& GetSessionID() const override;
+ SessionID GetSessionID() const override;
int GetTabCount() const override;
int GetSelectedIndex() const override;
std::string GetAppName() const override;