Bug 227017 - [GLib] Rewrite NetworkCache::Data::adoptMap without FileSystem::MappedFileData::leakHandle and munmap
Summary: [GLib] Rewrite NetworkCache::Data::adoptMap without FileSystem::MappedFileDat...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords: InRadar
Depends on:
Blocks: 227011
  Show dependency treegraph
 
Reported: 2021-06-15 00:44 PDT by Fujii Hironori
Modified: 2021-06-22 12:49 PDT (History)
7 users (show)

See Also:


Attachments
WIP patch (2.83 KB, patch)
2021-06-15 00:52 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (3.40 KB, patch)
2021-06-21 17:57 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2021-06-15 00:44:02 PDT
Rewrite NetworkCache::Data::adoptMap not to use FileSystem::MappedFileData::leakHandle

Bug 227011 is going to add a file mapping handle to
FileSystem::MappedFileData for Windows port create a SharedMemory
from a MappedFileData. Destruction of MappedFileData should be
done only by MappedFileData dtor.
Comment 1 Fujii Hironori 2021-06-15 00:52:03 PDT
Created attachment 431411 [details]
WIP patch
Comment 2 Chris Dumez 2021-06-15 08:32:06 PDT
Comment on attachment 431411 [details]
WIP patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431411&action=review

> Source/WebKit/NetworkProcess/cache/NetworkCacheDataCocoa.mm:98
> +    const void* map = mappedFile.data();

Which do you need to change Cocoa code? The new code is less efficient.
Comment 3 Fujii Hironori 2021-06-15 12:58:30 PDT
Comment on attachment 431411 [details]
WIP patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431411&action=review

>> Source/WebKit/NetworkProcess/cache/NetworkCacheDataCocoa.mm:98
>> +    const void* map = mappedFile.data();
> 
> Which do you need to change Cocoa code? The new code is less efficient.

This change isn't technically a mandatory for Bug 227017.
I can keep FileSystem::MappedFileData::leakHande just for this.

Because Bug 227017 is going to add HANDLE of a file mapping to
MappedFileData, the combination of
FileSystem::MappedFileData::leakHande and
FileSystem::unmapViewOfFile is too problematic.
That's the reason I want to remove.

But, I can keep MappedFileData::leakHande by adding #if !OS(WINDOWS) if you like.
Comment 4 Chris Dumez 2021-06-15 12:59:33 PDT
(In reply to Fujii Hironori from comment #3)
> Comment on attachment 431411 [details]
> WIP patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=431411&action=review
> 
> >> Source/WebKit/NetworkProcess/cache/NetworkCacheDataCocoa.mm:98
> >> +    const void* map = mappedFile.data();
> > 
> > Which do you need to change Cocoa code? The new code is less efficient.
> 
> This change isn't technically a mandatory for Bug 227017.
> I can keep FileSystem::MappedFileData::leakHande just for this.
> 
> Because Bug 227017 is going to add HANDLE of a file mapping to
> MappedFileData, the combination of
> FileSystem::MappedFileData::leakHande and
> FileSystem::unmapViewOfFile is too problematic.
> That's the reason I want to remove.
> 
> But, I can keep MappedFileData::leakHande by adding #if !OS(WINDOWS) if you
> like.

I think that would be good, since the replacement Cocoa code wouldn't be as efficient otherwise.
Comment 5 Fujii Hironori 2021-06-15 13:01:17 PDT
OK. Thank you.
Comment 6 Fujii Hironori 2021-06-21 14:58:19 PDT
Reopened. I'm going to fix only NetworkCacheDataGLib.cpp.
Comment 7 Fujii Hironori 2021-06-21 17:57:45 PDT
Created attachment 431935 [details]
Patch
Comment 8 Fujii Hironori 2021-06-22 12:48:13 PDT
Comment on attachment 431935 [details]
Patch

Clearing flags on attachment: 431935

Committed r279137 (239049@main): <https://commits.webkit.org/239049@main>
Comment 9 Fujii Hironori 2021-06-22 12:48:17 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Radar WebKit Bug Importer 2021-06-22 12:49:17 PDT
<rdar://problem/79628816>