├── .gitattributes ├── .gitignore ├── EdgeView.sln ├── EdgeView ├── EdgeView.vcxproj ├── EdgeView.vcxproj.filters ├── dllmain.cc ├── edgeview.rc ├── packages.config └── resource.h ├── LICENSE.txt ├── Readme.md ├── ec └── EdgeView.e ├── epltest ├── edgeview.dll ├── edgeview.ec ├── 使用前必读.txt └── 开发测试例.e └── src ├── Utf8Conv.hpp ├── base ├── bind │ ├── bind.h │ ├── bind_internal.h │ ├── callback.h │ ├── callback_forward.h │ ├── callback_helpers.cc │ ├── callback_helpers.h │ ├── callback_internal.cc │ ├── callback_internal.h │ ├── callback_list.cc │ ├── callback_list.h │ └── cancelable_callback.h ├── buildflags │ ├── build.h │ └── compiler_specific.h ├── debug │ ├── logging.cc │ └── logging.h ├── memory │ ├── atomic_flag.cc │ ├── atomic_flag.h │ ├── atomic_ref_count.h │ ├── auto_reset.h │ ├── lock.h │ ├── lock_impl.cc │ ├── lock_impl.h │ ├── raw_scoped_refptr_mismatch_checker.h │ ├── ref_counted.cc │ ├── ref_counted.h │ ├── scoped_refptr.h │ ├── weak_ptr.cc │ └── weak_ptr.h ├── template_util.h ├── third_party │ └── concurrentqueue │ │ ├── blockingconcurrentqueue.h │ │ ├── concurrentqueue.h │ │ └── lightweightsemaphore.h └── thread │ └── thread_checker.h ├── edgeview_data.cc ├── edgeview_data.h ├── ev_browser.cc ├── ev_browser.h ├── ev_contextmenu.cc ├── ev_contextmenu.h ├── ev_dom.cc ├── ev_dom.h ├── ev_download.cc ├── ev_download.h ├── ev_env.cc ├── ev_env.h ├── ev_extension.cc ├── ev_extension.h ├── ev_frame.cc ├── ev_frame.h ├── ev_msgpump.cc ├── ev_msgpump.h ├── ev_network.cc ├── ev_network.h ├── event_notify.cc ├── event_notify.h ├── modp_b64.cc ├── modp_b64.h ├── modp_b64_data.h ├── nlohmann └── json.hpp ├── struct_class.cc ├── struct_class.h ├── util.cc ├── util.h ├── webview_host.cc └── webview_host.h /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Oo]ut/ 21 | 22 | # Visual Studio 2015/2017 cache/options directory 23 | .vs/ 24 | # Uncomment if you have tasks that create the project's static files in wwwroot 25 | #wwwroot/ 26 | 27 | # Visual Studio 2017 auto generated files 28 | Generated\ Files/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUnit 35 | *.VisualState.xml 36 | TestResult.xml 37 | nunit-*.xml 38 | 39 | # Build Results of an ATL Project 40 | [Dd]ebugPS/ 41 | [Rr]eleasePS/ 42 | dlldata.c 43 | 44 | # Benchmark Results 45 | BenchmarkDotNet.Artifacts/ 46 | 47 | # .NET Core 48 | project.lock.json 49 | project.fragment.lock.json 50 | artifacts/ 51 | 52 | # ASP.NET Scaffolding 53 | ScaffoldingReadMe.txt 54 | 55 | # StyleCop 56 | StyleCopReport.xml 57 | 58 | # Files built by Visual Studio 59 | *_i.c 60 | *_p.c 61 | *_h.h 62 | *.ilk 63 | *.meta 64 | *.obj 65 | *.iobj 66 | *.pch 67 | *.pdb 68 | *.ipdb 69 | *.pgc 70 | *.pgd 71 | *.rsp 72 | *.sbr 73 | *.tlb 74 | *.tli 75 | *.tlh 76 | *.tmp 77 | *.tmp_proj 78 | *_wpftmp.csproj 79 | *.log 80 | *.vspscc 81 | *.vssscc 82 | .builds 83 | *.pidb 84 | *.svclog 85 | *.scc 86 | 87 | # Chutzpah Test files 88 | _Chutzpah* 89 | 90 | # Visual C++ cache files 91 | ipch/ 92 | *.aps 93 | *.ncb 94 | *.opendb 95 | *.opensdf 96 | *.sdf 97 | *.cachefile 98 | *.VC.db 99 | *.VC.VC.opendb 100 | 101 | # Visual Studio profiler 102 | *.psess 103 | *.vsp 104 | *.vspx 105 | *.sap 106 | 107 | # Visual Studio Trace Files 108 | *.e2e 109 | 110 | # TFS 2012 Local Workspace 111 | $tf/ 112 | 113 | # Guidance Automation Toolkit 114 | *.gpState 115 | 116 | # ReSharper is a .NET coding add-in 117 | _ReSharper*/ 118 | *.[Rr]e[Ss]harper 119 | *.DotSettings.user 120 | 121 | # TeamCity is a build add-in 122 | _TeamCity* 123 | 124 | # DotCover is a Code Coverage Tool 125 | *.dotCover 126 | 127 | # AxoCover is a Code Coverage Tool 128 | .axoCover/* 129 | !.axoCover/settings.json 130 | 131 | # Coverlet is a free, cross platform Code Coverage Tool 132 | coverage*.json 133 | coverage*.xml 134 | coverage*.info 135 | 136 | # Visual Studio code coverage results 137 | *.coverage 138 | *.coveragexml 139 | 140 | # NCrunch 141 | _NCrunch_* 142 | .*crunch*.local.xml 143 | nCrunchTemp_* 144 | 145 | # MightyMoose 146 | *.mm.* 147 | AutoTest.Net/ 148 | 149 | # Web workbench (sass) 150 | .sass-cache/ 151 | 152 | # Installshield output folder 153 | [Ee]xpress/ 154 | 155 | # DocProject is a documentation generator add-in 156 | DocProject/buildhelp/ 157 | DocProject/Help/*.HxT 158 | DocProject/Help/*.HxC 159 | DocProject/Help/*.hhc 160 | DocProject/Help/*.hhk 161 | DocProject/Help/*.hhp 162 | DocProject/Help/Html2 163 | DocProject/Help/html 164 | 165 | # Click-Once directory 166 | publish/ 167 | 168 | # Publish Web Output 169 | *.[Pp]ublish.xml 170 | *.azurePubxml 171 | # Note: Comment the next line if you want to checkin your web deploy settings, 172 | # but database connection strings (with potential passwords) will be unencrypted 173 | *.pubxml 174 | *.publishproj 175 | 176 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 177 | # checkin your Azure Web App publish settings, but sensitive information contained 178 | # in these scripts will be unencrypted 179 | PublishScripts/ 180 | 181 | # NuGet Packages 182 | *.nupkg 183 | # NuGet Symbol Packages 184 | *.snupkg 185 | # The packages folder can be ignored because of Package Restore 186 | **/[Pp]ackages/* 187 | # except build/, which is used as an MSBuild target. 188 | !**/[Pp]ackages/build/ 189 | # Uncomment if necessary however generally it will be regenerated when needed 190 | #!**/[Pp]ackages/repositories.config 191 | # NuGet v3's project.json files produces more ignorable files 192 | *.nuget.props 193 | *.nuget.targets 194 | 195 | # Microsoft Azure Build Output 196 | csx/ 197 | *.build.csdef 198 | 199 | # Microsoft Azure Emulator 200 | ecf/ 201 | rcf/ 202 | 203 | # Windows Store app package directories and files 204 | AppPackages/ 205 | BundleArtifacts/ 206 | Package.StoreAssociation.xml 207 | _pkginfo.txt 208 | *.appx 209 | *.appxbundle 210 | *.appxupload 211 | 212 | # Visual Studio cache files 213 | # files ending in .cache can be ignored 214 | *.[Cc]ache 215 | # but keep track of directories ending in .cache 216 | !?*.[Cc]ache/ 217 | 218 | # Others 219 | ClientBin/ 220 | ~$* 221 | *~ 222 | *.dbmdl 223 | *.dbproj.schemaview 224 | *.jfm 225 | *.pfx 226 | *.publishsettings 227 | orleans.codegen.cs 228 | 229 | # Including strong name files can present a security risk 230 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 231 | #*.snk 232 | 233 | # Since there are multiple workflows, uncomment next line to ignore bower_components 234 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 235 | #bower_components/ 236 | 237 | # RIA/Silverlight projects 238 | Generated_Code/ 239 | 240 | # Backup & report files from converting an old project file 241 | # to a newer Visual Studio version. Backup files are not needed, 242 | # because we have git ;-) 243 | _UpgradeReport_Files/ 244 | Backup*/ 245 | UpgradeLog*.XML 246 | UpgradeLog*.htm 247 | ServiceFabricBackup/ 248 | *.rptproj.bak 249 | 250 | # SQL Server files 251 | *.mdf 252 | *.ldf 253 | *.ndf 254 | 255 | # Business Intelligence projects 256 | *.rdl.data 257 | *.bim.layout 258 | *.bim_*.settings 259 | *.rptproj.rsuser 260 | *- [Bb]ackup.rdl 261 | *- [Bb]ackup ([0-9]).rdl 262 | *- [Bb]ackup ([0-9][0-9]).rdl 263 | 264 | # Microsoft Fakes 265 | FakesAssemblies/ 266 | 267 | # GhostDoc plugin setting file 268 | *.GhostDoc.xml 269 | 270 | # Node.js Tools for Visual Studio 271 | .ntvs_analysis.dat 272 | node_modules/ 273 | 274 | # Visual Studio 6 build log 275 | *.plg 276 | 277 | # Visual Studio 6 workspace options file 278 | *.opt 279 | 280 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 281 | *.vbw 282 | 283 | # Visual Studio LightSwitch build output 284 | **/*.HTMLClient/GeneratedArtifacts 285 | **/*.DesktopClient/GeneratedArtifacts 286 | **/*.DesktopClient/ModelManifest.xml 287 | **/*.Server/GeneratedArtifacts 288 | **/*.Server/ModelManifest.xml 289 | _Pvt_Extensions 290 | 291 | # Paket dependency manager 292 | .paket/paket.exe 293 | paket-files/ 294 | 295 | # FAKE - F# Make 296 | .fake/ 297 | 298 | # CodeRush personal settings 299 | .cr/personal 300 | 301 | # Python Tools for Visual Studio (PTVS) 302 | __pycache__/ 303 | *.pyc 304 | 305 | # Cake - Uncomment if you are using it 306 | # tools/** 307 | # !tools/packages.config 308 | 309 | # Tabs Studio 310 | *.tss 311 | 312 | # Telerik's JustMock configuration file 313 | *.jmconfig 314 | 315 | # BizTalk build output 316 | *.btp.cs 317 | *.btm.cs 318 | *.odx.cs 319 | *.xsd.cs 320 | 321 | # OpenCover UI analysis results 322 | OpenCover/ 323 | 324 | # Azure Stream Analytics local run output 325 | ASALocalRun/ 326 | 327 | # MSBuild Binary and Structured Log 328 | *.binlog 329 | 330 | # NVidia Nsight GPU debugger configuration file 331 | *.nvuser 332 | 333 | # MFractors (Xamarin productivity tool) working folder 334 | .mfractor/ 335 | 336 | # Local History for Visual Studio 337 | .localhistory/ 338 | 339 | # BeatPulse healthcheck temp database 340 | healthchecksdb 341 | 342 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 343 | MigrationBackup/ 344 | 345 | # Ionide (cross platform F# VS Code tools) working folder 346 | .ionide/ 347 | 348 | # Fody - auto-generated XML schema 349 | FodyWeavers.xsd 350 | 351 | .vs/ 352 | EdgeView/Release 353 | /epltest/tabControl 354 | /epltest 355 | /EdgeView/ReleaseStatic 356 | -------------------------------------------------------------------------------- /EdgeView.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.12.35514.174 d17.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EdgeView", "EdgeView\EdgeView.vcxproj", "{AB19DC04-80B8-473B-BF20-90BF4EFE215F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {AB19DC04-80B8-473B-BF20-90BF4EFE215F}.Debug|x64.ActiveCfg = Debug|x64 17 | {AB19DC04-80B8-473B-BF20-90BF4EFE215F}.Debug|x64.Build.0 = Debug|x64 18 | {AB19DC04-80B8-473B-BF20-90BF4EFE215F}.Debug|x86.ActiveCfg = Debug|Win32 19 | {AB19DC04-80B8-473B-BF20-90BF4EFE215F}.Debug|x86.Build.0 = Debug|Win32 20 | {AB19DC04-80B8-473B-BF20-90BF4EFE215F}.Release|x64.ActiveCfg = Release|x64 21 | {AB19DC04-80B8-473B-BF20-90BF4EFE215F}.Release|x64.Build.0 = Release|x64 22 | {AB19DC04-80B8-473B-BF20-90BF4EFE215F}.Release|x86.ActiveCfg = Release|Win32 23 | {AB19DC04-80B8-473B-BF20-90BF4EFE215F}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {0EDC710D-5EB1-4B5D-AE1F-5157ED95464F} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /EdgeView/EdgeView.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {a956086c-7726-4cf6-aa13-b2a2da3f763e} 10 | 11 | 12 | {a30a0c15-8e43-478b-96c2-4f24b57c5e3e} 13 | 14 | 15 | {097c15a6-f5fa-4ad2-8d7b-de8d493f0ef2} 16 | 17 | 18 | {f5d5b89c-37a4-4d13-9563-0419aa39fd2c} 19 | 20 | 21 | 22 | 23 | entry 24 | 25 | 26 | src 27 | 28 | 29 | src\base 30 | 31 | 32 | src\base 33 | 34 | 35 | src\base 36 | 37 | 38 | src\base 39 | 40 | 41 | src\base 42 | 43 | 44 | src\base 45 | 46 | 47 | src\base 48 | 49 | 50 | src\base 51 | 52 | 53 | src 54 | 55 | 56 | src 57 | 58 | 59 | src 60 | 61 | 62 | src 63 | 64 | 65 | src 66 | 67 | 68 | src 69 | 70 | 71 | src 72 | 73 | 74 | src 75 | 76 | 77 | src 78 | 79 | 80 | src 81 | 82 | 83 | src 84 | 85 | 86 | src 87 | 88 | 89 | src 90 | 91 | 92 | 93 | 94 | ec 95 | 96 | 97 | 98 | 99 | 100 | src 101 | 102 | 103 | src 104 | 105 | 106 | src\base 107 | 108 | 109 | src\base 110 | 111 | 112 | src\base 113 | 114 | 115 | src\base 116 | 117 | 118 | src\base 119 | 120 | 121 | src\base 122 | 123 | 124 | src\base 125 | 126 | 127 | src\base 128 | 129 | 130 | src\base 131 | 132 | 133 | src\base 134 | 135 | 136 | src\base 137 | 138 | 139 | src\base 140 | 141 | 142 | src\base 143 | 144 | 145 | src\base 146 | 147 | 148 | src\base 149 | 150 | 151 | src\base 152 | 153 | 154 | src\base 155 | 156 | 157 | src\base 158 | 159 | 160 | src\base 161 | 162 | 163 | src\base 164 | 165 | 166 | src\base 167 | 168 | 169 | src\base 170 | 171 | 172 | src\base 173 | 174 | 175 | src\base 176 | 177 | 178 | src\base 179 | 180 | 181 | src 182 | 183 | 184 | src 185 | 186 | 187 | src 188 | 189 | 190 | src 191 | 192 | 193 | src 194 | 195 | 196 | res 197 | 198 | 199 | src 200 | 201 | 202 | src 203 | 204 | 205 | src 206 | 207 | 208 | src 209 | 210 | 211 | src 212 | 213 | 214 | src 215 | 216 | 217 | src 218 | 219 | 220 | src 221 | 222 | 223 | src 224 | 225 | 226 | src 227 | 228 | 229 | 230 | 231 | res 232 | 233 | 234 | 235 | 236 | 237 | -------------------------------------------------------------------------------- /EdgeView/dllmain.cc: -------------------------------------------------------------------------------- 1 |  2 | #include 3 | 4 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, 5 | LPVOID lpReserved) { 6 | switch (ul_reason_for_call) { 7 | case DLL_PROCESS_ATTACH: 8 | case DLL_THREAD_ATTACH: 9 | case DLL_THREAD_DETACH: 10 | case DLL_PROCESS_DETACH: 11 | break; 12 | } 13 | return TRUE; 14 | } 15 | -------------------------------------------------------------------------------- /EdgeView/edgeview.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Admenri/EdgeView/c556e12253ba1903dd9dca8b3993b34da2c7a33e/EdgeView/edgeview.rc -------------------------------------------------------------------------------- /EdgeView/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /EdgeView/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Admenri/EdgeView/c556e12253ba1903dd9dca8b3993b34da2c7a33e/EdgeView/resource.h -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # EdgeView 2 | 3 | ## 项目概述 4 | 5 | 本库是为易语言编写的WebView2封装调用库,已进行线程隔离,支持多线程同步调用, 6 | 同时借助CDP的功能实现原版之外的附加内容。 7 | 8 | ## 注意事项 9 | 10 | 作者QQ:2755482106 11 | 12 | 本库禁止用于违法违规用途,否则后果自负。 13 | 14 | 【付费】用户群:372404087 15 | 【说明】本库开源免费,但不代表劳动免费,如果需要额外例程教程和问题咨询, 16 | 只能付费加入用户群获取帮助,如果你认为免费是理所应当的请不要下载使用本库。 17 | 模块免费使用,作者不对此提供任何免费的技术支持非常合理。 18 | ※ 所以白嫖跳脸狗请自觉删除本库,作者产品不提供给狗使用。 19 | 20 | © 2023 Admenri -------------------------------------------------------------------------------- /ec/EdgeView.e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Admenri/EdgeView/c556e12253ba1903dd9dca8b3993b34da2c7a33e/ec/EdgeView.e -------------------------------------------------------------------------------- /epltest/edgeview.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Admenri/EdgeView/c556e12253ba1903dd9dca8b3993b34da2c7a33e/epltest/edgeview.dll -------------------------------------------------------------------------------- /epltest/edgeview.ec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Admenri/EdgeView/c556e12253ba1903dd9dca8b3993b34da2c7a33e/epltest/edgeview.ec -------------------------------------------------------------------------------- /epltest/使用前必读.txt: -------------------------------------------------------------------------------- 1 | EdgeView浏览器框架模块属易语言WebView2封装, 2 | 前身为EWebVeiw2模块,现时隔1年对其进行重写和加强。 3 | 4 | 作者QQ:2755482106(不闲聊) 5 | 交流用户群:372404087(付费50入群) 6 | 7 | 由原先的强制收费改为付费入群模式, 8 | 仅入群可查看使用手册及更多例程教程, 9 | 作者仅在EdgeView用户群提供技术支持。 10 | 11 | 如果你觉得付费入群免费使用的方式不能接受, 12 | 请立即删除本模块,喷子与狗不得使用。 13 | 14 | 免费发行包内仅包含核心模块和开发测试例程。 15 | 付费群内可下载多标签及其他例程,同时提供咨询服务。 16 | 17 | 如果感觉webview2的功能无法满足你,可以选择使用免费的ACF: 18 | 用户群:255175967 19 | -------------------------------------------------------------------------------- /epltest/开发测试例.e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Admenri/EdgeView/c556e12253ba1903dd9dca8b3993b34da2c7a33e/epltest/开发测试例.e -------------------------------------------------------------------------------- /src/base/bind/callback.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 2 | // Google Inc. All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the name Chromium Embedded 15 | // Framework nor the names of its contributors may be used to endorse 16 | // or promote products derived from this software without specific prior 17 | // written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | /// \file 32 | /// A callback is similar in concept to a function pointer: it wraps a runnable 33 | /// object such as a function, method, lambda, or even another callback, 34 | /// allowing the runnable object to be invoked later via the callback object. 35 | /// 36 | /// Unlike function pointers, callbacks are created with base::BindOnce() or 37 | /// base::BindRepeating() and support partial function application. 38 | /// 39 | /// A base::OnceCallback may be Run() at most once; a base::RepeatingCallback 40 | /// may be Run() any number of times. |is_null()| is guaranteed to return true 41 | /// for a moved-from callback. 42 | /// 43 | ///
 44 | ///   // The lambda takes two arguments, but the first argument |x| is bound at
 45 | ///   // callback creation.
 46 | ///   base::OnceCallback cb = base::BindOnce([] (int x, int y) {
 47 | ///     return x + y;
 48 | ///   }, 1);
 49 | ///   // Run() only needs the remaining unbound argument |y|.
 50 | ///   printf("1 + 2 = %d\n", std::move(cb).Run(2));  // Prints 3
 51 | ///   printf("cb is null? %s\n",
 52 | ///          cb.is_null() ? "true" : "false");  // Prints true
 53 | ///   std::move(cb).Run(2);  // Crashes since |cb| has already run.
 54 | /// 
55 | /// 56 | /// Callbacks also support cancellation. A common use is binding the receiver 57 | /// object as a WeakPtr. If that weak pointer is invalidated, calling Run() 58 | /// will be a no-op. Note that |IsCancelled()| and |is_null()| are distinct: 59 | /// simply cancelling a callback will not also make it null. 60 | /// 61 | /// See https://chromium.googlesource.com/chromium/src/+/lkgr/docs/callback.md 62 | /// for the full documentation. 63 | 64 | #ifndef BASE_BIND_CALLBACK_H_ 65 | #define BASE_BIND_CALLBACK_H_ 66 | 67 | // The following is substantially similar to the Chromium implementation. 68 | // If the Chromium implementation diverges the below implementation should be 69 | // updated to match. 70 | 71 | #include 72 | 73 | #include "base/bind/bind.h" 74 | #include "base/bind/callback_forward.h" 75 | #include "base/bind/callback_internal.h" 76 | #include "base/debug/logging.h" 77 | 78 | namespace base { 79 | 80 | template 81 | class OnceCallback : public internal::CallbackBase { 82 | public: 83 | using ResultType = R; 84 | using RunType = R(Args...); 85 | using PolymorphicInvoke = R (*)(internal::BindStateBase*, 86 | internal::PassingType...); 87 | 88 | constexpr OnceCallback() = default; 89 | OnceCallback(std::nullptr_t) = delete; 90 | 91 | explicit OnceCallback(internal::BindStateBase* bind_state) 92 | : internal::CallbackBase(bind_state) {} 93 | 94 | OnceCallback(const OnceCallback&) = delete; 95 | OnceCallback& operator=(const OnceCallback&) = delete; 96 | 97 | OnceCallback(OnceCallback&&) noexcept = default; 98 | OnceCallback& operator=(OnceCallback&&) noexcept = default; 99 | 100 | OnceCallback(RepeatingCallback other) 101 | : internal::CallbackBase(std::move(other)) {} 102 | 103 | OnceCallback& operator=(RepeatingCallback other) { 104 | static_cast(*this) = std::move(other); 105 | return *this; 106 | } 107 | 108 | R Run(Args... args) const& { 109 | static_assert(!sizeof(*this), 110 | "OnceCallback::Run() may only be invoked on a non-const " 111 | "rvalue, i.e. std::move(callback).Run()."); 112 | NOTREACHED(); 113 | } 114 | 115 | R Run(Args... args) && { 116 | // Move the callback instance into a local variable before the invocation, 117 | // that ensures the internal state is cleared after the invocation. 118 | // It's not safe to touch |this| after the invocation, since running the 119 | // bound function may destroy |this|. 120 | OnceCallback cb = std::move(*this); 121 | PolymorphicInvoke f = 122 | reinterpret_cast(cb.polymorphic_invoke()); 123 | return f(cb.bind_state_.get(), std::forward(args)...); 124 | } 125 | 126 | // Then() returns a new OnceCallback that receives the same arguments as 127 | // |this|, and with the return type of |then|. The returned callback will: 128 | // 1) Run the functor currently bound to |this| callback. 129 | // 2) Run the |then| callback with the result from step 1 as its single 130 | // argument. 131 | // 3) Return the value from running the |then| callback. 132 | // 133 | // Since this method generates a callback that is a replacement for `this`, 134 | // `this` will be consumed and reset to a null callback to ensure the 135 | // originally-bound functor can be run at most once. 136 | template 137 | OnceCallback Then(OnceCallback then) && { 138 | CHECK(then); 139 | return BindOnce( 140 | internal::ThenHelper< 141 | OnceCallback, OnceCallback>::CreateTrampoline(), 142 | std::move(*this), std::move(then)); 143 | } 144 | 145 | // This overload is required; even though RepeatingCallback is implicitly 146 | // convertible to OnceCallback, that conversion will not used when matching 147 | // for template argument deduction. 148 | template 149 | OnceCallback Then( 150 | RepeatingCallback then) && { 151 | CHECK(then); 152 | return BindOnce( 153 | internal::ThenHelper< 154 | OnceCallback, 155 | RepeatingCallback>::CreateTrampoline(), 156 | std::move(*this), std::move(then)); 157 | } 158 | }; 159 | 160 | template 161 | class RepeatingCallback : public internal::CallbackBaseCopyable { 162 | public: 163 | using ResultType = R; 164 | using RunType = R(Args...); 165 | using PolymorphicInvoke = R (*)(internal::BindStateBase*, 166 | internal::PassingType...); 167 | 168 | constexpr RepeatingCallback() = default; 169 | RepeatingCallback(std::nullptr_t) = delete; 170 | 171 | explicit RepeatingCallback(internal::BindStateBase* bind_state) 172 | : internal::CallbackBaseCopyable(bind_state) {} 173 | 174 | // Copyable and movable. 175 | RepeatingCallback(const RepeatingCallback&) = default; 176 | RepeatingCallback& operator=(const RepeatingCallback&) = default; 177 | RepeatingCallback(RepeatingCallback&&) noexcept = default; 178 | RepeatingCallback& operator=(RepeatingCallback&&) noexcept = default; 179 | 180 | bool operator==(const RepeatingCallback& other) const { 181 | return EqualsInternal(other); 182 | } 183 | 184 | bool operator!=(const RepeatingCallback& other) const { 185 | return !operator==(other); 186 | } 187 | 188 | R Run(Args... args) const& { 189 | PolymorphicInvoke f = 190 | reinterpret_cast(this->polymorphic_invoke()); 191 | return f(this->bind_state_.get(), std::forward(args)...); 192 | } 193 | 194 | R Run(Args... args) && { 195 | // Move the callback instance into a local variable before the invocation, 196 | // that ensures the internal state is cleared after the invocation. 197 | // It's not safe to touch |this| after the invocation, since running the 198 | // bound function may destroy |this|. 199 | RepeatingCallback cb = std::move(*this); 200 | PolymorphicInvoke f = 201 | reinterpret_cast(cb.polymorphic_invoke()); 202 | return f(std::move(cb).bind_state_.get(), std::forward(args)...); 203 | } 204 | 205 | // Then() returns a new RepeatingCallback that receives the same arguments as 206 | // |this|, and with the return type of |then|. The 207 | // returned callback will: 208 | // 1) Run the functor currently bound to |this| callback. 209 | // 2) Run the |then| callback with the result from step 1 as its single 210 | // argument. 211 | // 3) Return the value from running the |then| callback. 212 | // 213 | // If called on an rvalue (e.g. std::move(cb).Then(...)), this method 214 | // generates a callback that is a replacement for `this`. Therefore, `this` 215 | // will be consumed and reset to a null callback to ensure the 216 | // originally-bound functor will be run at most once. 217 | template 218 | RepeatingCallback Then( 219 | RepeatingCallback then) const& { 220 | CHECK(then); 221 | return BindRepeating( 222 | internal::ThenHelper< 223 | RepeatingCallback, 224 | RepeatingCallback>::CreateTrampoline(), 225 | *this, std::move(then)); 226 | } 227 | 228 | template 229 | RepeatingCallback Then( 230 | RepeatingCallback then) && { 231 | CHECK(then); 232 | return BindRepeating( 233 | internal::ThenHelper< 234 | RepeatingCallback, 235 | RepeatingCallback>::CreateTrampoline(), 236 | std::move(*this), std::move(then)); 237 | } 238 | }; 239 | 240 | } // namespace base 241 | 242 | #endif // BASE_BIND_CALLBACK_H_ 243 | -------------------------------------------------------------------------------- /src/base/bind/callback_forward.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 2 | // Google Inc. All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the name Chromium Embedded 15 | // Framework nor the names of its contributors may be used to endorse 16 | // or promote products derived from this software without specific prior 17 | // written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | #ifndef BASE_BIND_CALLBACK_FORWARD_H_ 32 | #define BASE_BIND_CALLBACK_FORWARD_H_ 33 | 34 | // The following is substantially similar to the Chromium implementation. 35 | // If the Chromium implementation diverges the below implementation should be 36 | // updated to match. 37 | 38 | namespace base { 39 | 40 | template 41 | class OnceCallback; 42 | 43 | template 44 | class RepeatingCallback; 45 | 46 | /// 47 | /// Syntactic sugar to make OnceClosure and RepeatingClosure 48 | /// easier to declare since they will be used in a lot of APIs with delayed 49 | /// execution. 50 | /// 51 | using OnceClosure = OnceCallback; 52 | using RepeatingClosure = RepeatingCallback; 53 | 54 | } // namespace base 55 | 56 | #endif // BASE_BIND_CALLBACK_FORWARD_H_ 57 | -------------------------------------------------------------------------------- /src/base/bind/callback_helpers.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "base/bind/callback_helpers.h" 6 | 7 | namespace base { 8 | 9 | ScopedClosureRunner::ScopedClosureRunner() = default; 10 | 11 | ScopedClosureRunner::ScopedClosureRunner(OnceClosure closure) 12 | : closure_(std::move(closure)) {} 13 | 14 | ScopedClosureRunner::ScopedClosureRunner(ScopedClosureRunner&& other) 15 | : closure_(other.Release()) {} 16 | 17 | ScopedClosureRunner& ScopedClosureRunner::operator=( 18 | ScopedClosureRunner&& other) { 19 | if (this != &other) { 20 | RunAndReset(); 21 | ReplaceClosure(other.Release()); 22 | } 23 | return *this; 24 | } 25 | 26 | ScopedClosureRunner::~ScopedClosureRunner() { RunAndReset(); } 27 | 28 | void ScopedClosureRunner::RunAndReset() { 29 | if (closure_) { 30 | std::move(closure_).Run(); 31 | } 32 | } 33 | 34 | void ScopedClosureRunner::ReplaceClosure(OnceClosure closure) { 35 | closure_ = std::move(closure); 36 | } 37 | 38 | OnceClosure ScopedClosureRunner::Release() { return std::move(closure_); } 39 | 40 | } // namespace base 41 | -------------------------------------------------------------------------------- /src/base/bind/callback_helpers.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 2 | // Google Inc. All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the name Chromium Embedded 15 | // Framework nor the names of its contributors may be used to endorse 16 | // or promote products derived from this software without specific prior 17 | // written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // This defines helpful methods for dealing with Callbacks. Because Callbacks 32 | // are implemented using templates, with a class per callback signature, adding 33 | // methods to Callback<> itself is unattractive (lots of extra code gets 34 | // generated). Instead, consider adding methods here. 35 | 36 | #ifndef BASE_BIND_CALLBACK_HELPERS_H_ 37 | #define BASE_BIND_CALLBACK_HELPERS_H_ 38 | 39 | // The following is substantially similar to the Chromium implementation. 40 | // If the Chromium implementation diverges the below implementation should be 41 | // updated to match. 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #include "base/bind/bind.h" 49 | #include "base/bind/callback.h" 50 | #include "base/debug/logging.h" 51 | 52 | namespace base { 53 | 54 | namespace internal { 55 | 56 | template 57 | struct IsBaseCallbackImpl : std::false_type {}; 58 | 59 | template 60 | struct IsBaseCallbackImpl> : std::true_type {}; 61 | 62 | template 63 | struct IsBaseCallbackImpl> : std::true_type {}; 64 | 65 | template 66 | struct IsOnceCallbackImpl : std::false_type {}; 67 | 68 | template 69 | struct IsOnceCallbackImpl> : std::true_type {}; 70 | 71 | } // namespace internal 72 | 73 | /// 74 | /// IsBaseCallback::value is true when T is any of the Closure or Callback 75 | /// family of types. 76 | /// 77 | template 78 | using IsBaseCallback = internal::IsBaseCallbackImpl>; 79 | 80 | /// 81 | /// IsOnceCallback::value is true when T is a OnceClosure or OnceCallback 82 | /// type. 83 | /// 84 | template 85 | using IsOnceCallback = internal::IsOnceCallbackImpl>; 86 | 87 | /// 88 | /// SFINAE friendly enabler allowing to overload methods for both Repeating and 89 | /// OnceCallbacks. 90 | /// 91 | /// Usage: 92 | ///
 93 | ///   template