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

Side by Side Diff: chrome/install_static/install_details.cc

Issue 2635953002: Use loader-based binding of GetInstallDetailsPayload for install_static. (Closed)
Patch Set: sync to position 444298 Created 3 years, 11 months 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
« no previous file with comments | « chrome/install_static/install_details.h ('k') | chrome_elf/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/install_static/install_details.h" 5 #include "chrome/install_static/install_details.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <type_traits> 10 #include <type_traits>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // static 60 // static
61 const InstallDetails::Payload* InstallDetails::GetPayload() { 61 const InstallDetails::Payload* InstallDetails::GetPayload() {
62 assert(g_module_details); 62 assert(g_module_details);
63 static_assert(std::is_pod<Payload>::value, "Payload must be a POD-struct"); 63 static_assert(std::is_pod<Payload>::value, "Payload must be a POD-struct");
64 static_assert(std::is_pod<InstallConstants>::value, 64 static_assert(std::is_pod<InstallConstants>::value,
65 "InstallConstants must be a POD-struct"); 65 "InstallConstants must be a POD-struct");
66 return g_module_details->payload_; 66 return g_module_details->payload_;
67 } 67 }
68 68
69 // static 69 // static
70 void InstallDetails::InitializeFromPrimaryModule( 70 void InstallDetails::InitializeFromPayload(
71 const wchar_t* primary_module_name) { 71 const InstallDetails::Payload* payload) {
72 assert(!g_module_details); 72 assert(!g_module_details);
73 using GetInstallDetailsPayloadFunction = const Payload*(__cdecl*)();
74 GetInstallDetailsPayloadFunction payload_getter =
75 reinterpret_cast<GetInstallDetailsPayloadFunction>(::GetProcAddress(
76 ::GetModuleHandle(primary_module_name), "GetInstallDetailsPayload"));
77 assert(payload_getter);
78 // Intentionally leaked at shutdown. 73 // Intentionally leaked at shutdown.
79 g_module_details = new InstallDetails(payload_getter()); 74 g_module_details = new InstallDetails(payload);
80 } 75 }
81 76
82 PrimaryInstallDetails::PrimaryInstallDetails() : InstallDetails(&payload_) { 77 PrimaryInstallDetails::PrimaryInstallDetails() : InstallDetails(&payload_) {
83 payload_.size = sizeof(payload_); 78 payload_.size = sizeof(payload_);
84 payload_.product_version = &kProductVersion[0]; 79 payload_.product_version = &kProductVersion[0];
85 } 80 }
86 81
87 } // namespace install_static 82 } // namespace install_static
OLDNEW
« no previous file with comments | « chrome/install_static/install_details.h ('k') | chrome_elf/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698