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

Unified Diff: content/browser/file_descriptor_info_impl.h

Issue 2613803003: Simplifying ContentBrowserClient::GetAdditionalMappedFiles...() (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/file_descriptor_info_impl.h
diff --git a/content/browser/file_descriptor_info_impl.h b/content/browser/file_descriptor_info_impl.h
index 010e797c1d846dc817dea4f05c06fd300e14162e..eba0937d26313a15c05d416d759b19b60f523612 100644
--- a/content/browser/file_descriptor_info_impl.h
+++ b/content/browser/file_descriptor_info_impl.h
@@ -7,9 +7,11 @@
#include <stddef.h>
+#include <map>
#include <memory>
#include <vector>
+#include "base/files/memory_mapped_file.h"
#include "content/common/content_export.h"
#include "content/public/browser/file_descriptor_info.h"
@@ -21,12 +23,15 @@ class FileDescriptorInfoImpl : public FileDescriptorInfo {
~FileDescriptorInfoImpl() override;
void Share(int id, base::PlatformFile fd) override;
+ void ShareWithRegion(int id, base::PlatformFile fd,
+ const base::MemoryMappedFile::Region& region) override;
void Transfer(int id, base::ScopedFD fd) override;
const base::FileHandleMappingVector& GetMapping() const override;
base::FileHandleMappingVector GetMappingWithIDAdjustment(
int delta) const override;
base::PlatformFile GetFDAt(size_t i) const override;
int GetIDAt(size_t i) const override;
+ const base::MemoryMappedFile::Region& GetRegionAt(size_t i) const override;
size_t GetMappingSize() const override;
bool OwnsFD(base::PlatformFile file) const override;
base::ScopedFD ReleaseFD(base::PlatformFile file) override;
@@ -34,9 +39,13 @@ class FileDescriptorInfoImpl : public FileDescriptorInfo {
private:
FileDescriptorInfoImpl();
- void AddToMapping(int id, base::PlatformFile fd);
+ void AddToMapping(int id, base::PlatformFile fd,
+ const base::MemoryMappedFile::Region& region);
bool HasID(int id) const;
base::FileHandleMappingVector mapping_;
+ // Maps the ID of a FD to the region to use for that FD, the whole file if not
+ // in the map.
+ std::map<int, base::MemoryMappedFile::Region> ids_to_regions_;
std::vector<base::ScopedFD> owned_descriptors_;
};
}

Powered by Google App Engine
This is Rietveld 408576698