-
Notifications
You must be signed in to change notification settings - Fork 653
Implement --unlimited-storage switch for crosswalk #3958
Conversation
Testing patch series with medic/crosswalk@df296ff as its head.
|
Thanks, @rakuco. copyright messages added; I hope these are correct. |
Testing patch series with medic/crosswalk@00dac1a as its head.
|
@fujunwei Please have a look |
@@ -212,6 +213,14 @@ XWalkBrowserContext::GetGuestManager() { | |||
} | |||
|
|||
storage::SpecialStoragePolicy* XWalkBrowserContext::GetSpecialStoragePolicy() { | |||
LOG(WARNING) << "XWalkBrowserContext::GetSpecialStoragePolicy() :: " << |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify or move the LOG.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
// TODO cache the XwalkSpecialStoragePolicy instance? | ||
if (base::CommandLine::ForCurrentProcess()->HasSwitch( | ||
switches::kUnlimitedStorage)) | ||
return new xwalk::XWalkSpecialStoragePolicy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cache the instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a go at implementing this now, but some questions:
- Should it be initialised lazily?
- If so, does initialisation need to be thread-safe?
For now, I will assume that initialising the XWalkSpecialStoragePolicy
in the constructor of XWalkBrowserContext
is appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instance now created at XWalkBrowserContext
instantiation time iff required.
|
||
#include <iostream> | ||
|
||
#include "xwalk/runtime/browser/xwalk_special_storage_policy.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Use BUG=XWALK-7413 instead of "Implementation of https://crosswalk-project.org/jira/browse/XWALK-7413" |
Testing patch series with medic/crosswalk@2da9da4 as its head.
|
Testing patch series with medic/crosswalk@0cdf78b as its head.
|
Testing patch series with medic/crosswalk@166cc1b as its head.
|
Testing patch series with medic/crosswalk@02d2601 as its head.
|
LGTM |
1 similar comment
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are just some minor adjustments left before we're able to merge this. Sorry it's taking so long.
@@ -147,6 +147,8 @@ class XWalkBrowserContext | |||
std::unique_ptr<XWalkSSLHostStateDelegate> ssl_host_state_delegate_; | |||
std::unique_ptr<content::PermissionManager> permission_manager_; | |||
|
|||
storage::SpecialStoragePolicy* special_storiage_policy_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this is being leaked; I think you can follow what we do with the pointers above this one and use a std::unique_ptr
here. I also think you can instantiate it in GetSpecialStoragePolicy()
itself like the other getters do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, and I fixed the spelling mistake too :¬)
|
||
#include "xwalk/runtime/browser/xwalk_special_storage_policy.h" | ||
|
||
#include <iostream> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this include is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, and removed.
Testing patch series with medic/crosswalk@a168292 as its head.
|
Testing patch series with medic/crosswalk@24a14c5 as its head.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, std::unique_ptr seems to have broken the build.
bool IsStorageDurable(const GURL& origin) override; | ||
|
||
protected: | ||
~XWalkSpecialStoragePolicy() override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is breaking the build now that you're using a unique_ptr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, just saw this. I'll take a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @rakuco I don't understand the compile error. Is it clear to you what's wrong?
Testing patch series with medic/crosswalk@e158f39 as its head.
|
Testing patch series with medic/crosswalk@0a6f06e as its head.
|
Looking at the latest build error, I think you'll need to use a |
Testing patch series with medic/crosswalk@3d52973 as its head.
|
@@ -146,6 +146,7 @@ class XWalkBrowserContext | |||
PartitionPathContextGetterMap context_getters_; | |||
std::unique_ptr<XWalkSSLHostStateDelegate> ssl_host_state_delegate_; | |||
std::unique_ptr<content::PermissionManager> permission_manager_; | |||
scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thiknk you mean scoped_refptr<XWalkSpecialStoragePolicy>
here.
Testing patch series with medic/crosswalk@3ab2048 as its head.
|
@@ -146,6 +146,7 @@ class XWalkBrowserContext | |||
PartitionPathContextGetterMap context_getters_; | |||
std::unique_ptr<XWalkSSLHostStateDelegate> ssl_host_state_delegate_; | |||
std::unique_ptr<content::PermissionManager> permission_manager_; | |||
scoped_refptr<XWalkSpecialStoragePolicy> special_storage_policy_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to include the appropriate header declaring XWalkSpecialStoragePolicy
...
When this switch is added to the crosswalk command-line, a SpecialStoragePolicy is enabled which allows crosswalk to use the total free space available on the device, instead of Chromium's standard of 10% of available space. BUG=XWALK-7413
Testing patch series with medic/crosswalk@716cad2 as its head.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Success at last!
Great! Thanks for your patience :¬) |
When this switch is added to the crosswalk command-line, a SpecialStoragePolicy
is enabled which allows crosswalk to use the total free space available on the
device, instead of Chromium's standard of 10% of available space.
Implementation of https://crosswalk-project.org/jira/browse/XWALK-7413