Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Implement --unlimited-storage switch for crosswalk #3958

Merged
merged 1 commit into from
Dec 2, 2016

Conversation

alxndrsn
Copy link
Contributor

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

@rakuco
Copy link
Member

rakuco commented Nov 18, 2016

ping @lincsoon @xzhan96
@alxndrsn: thanks for the patch. can you add the appropriate copyright headers to the files you've added?

@crosswalk-trybot
Copy link

crosswalk-trybot commented Nov 18, 2016

Testing patch series with medic/crosswalk@df296ff as its head.

Bot Status
Crosswalk Android-X86 [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4868)
Crosswalk Android x86-64 [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1918)
Crosswalk Linux [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4858)

@alxndrsn
Copy link
Contributor Author

alxndrsn commented Nov 18, 2016

Thanks, @rakuco. copyright messages added; I hope these are correct.

@crosswalk-trybot
Copy link

crosswalk-trybot commented Nov 21, 2016

Testing patch series with medic/crosswalk@00dac1a as its head.

Bot Status
Crosswalk Android-X86 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4869)
Crosswalk Android x86-64 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1919)
Crosswalk Linux [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4859)

@sunlin-link
Copy link
Contributor

@fujunwei Please have a look

@@ -212,6 +213,14 @@ XWalkBrowserContext::GetGuestManager() {
}

storage::SpecialStoragePolicy* XWalkBrowserContext::GetSpecialStoragePolicy() {
LOG(WARNING) << "XWalkBrowserContext::GetSpecialStoragePolicy() :: " <<
Copy link
Contributor

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.

Copy link
Contributor Author

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cache the instance.

Copy link
Contributor Author

@alxndrsn alxndrsn Nov 24, 2016

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:

  1. Should it be initialised lazily?
  2. 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.

Copy link
Contributor Author

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First statement

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@xzhan96
Copy link
Contributor

xzhan96 commented Nov 24, 2016

Use BUG=XWALK-7413 instead of "Implementation of https://crosswalk-project.org/jira/browse/XWALK-7413"

@crosswalk-trybot
Copy link

crosswalk-trybot commented Nov 24, 2016

Testing patch series with medic/crosswalk@2da9da4 as its head.

Bot Status
Crosswalk Android-X86 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4870)
Crosswalk Android x86-64 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1920)
Crosswalk Linux [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4860)

@crosswalk-trybot
Copy link

crosswalk-trybot commented Nov 24, 2016

Testing patch series with medic/crosswalk@0cdf78b as its head.

Bot Status
Crosswalk Linux [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4861)
Crosswalk Android x86-64 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1921)
Crosswalk Android-X86 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4871)

@crosswalk-trybot
Copy link

crosswalk-trybot commented Nov 24, 2016

Testing patch series with medic/crosswalk@166cc1b as its head.

Bot Status
Crosswalk Linux [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4862)
Crosswalk Android x86-64 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1922)
Crosswalk Android-X86 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4872)

@crosswalk-trybot
Copy link

crosswalk-trybot commented Nov 25, 2016

Testing patch series with medic/crosswalk@02d2601 as its head.

Bot Status
Crosswalk Android-X86 [In Progress](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4873)
Crosswalk Android x86-64 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1923)
Crosswalk Linux [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4863)

@rakuco
Copy link
Member

rakuco commented Nov 30, 2016

@lincsoon @fujunwei @xzhan96: re-ping

@xzhan96
Copy link
Contributor

xzhan96 commented Dec 1, 2016

LGTM

1 similar comment
@fujunwei
Copy link
Contributor

fujunwei commented Dec 1, 2016

LGTM

Copy link
Member

@rakuco rakuco left a 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_;
Copy link
Member

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.

Copy link
Contributor Author

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>
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, and removed.

@crosswalk-trybot
Copy link

crosswalk-trybot commented Dec 1, 2016

Testing patch series with medic/crosswalk@a168292 as its head.

Bot Status
Crosswalk Android-X86 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4874)
Crosswalk Android x86-64 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1924)
Crosswalk Linux [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4864)

@crosswalk-trybot
Copy link

crosswalk-trybot commented Dec 1, 2016

Testing patch series with medic/crosswalk@24a14c5 as its head.

Bot Status
Crosswalk Linux [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4865)
Crosswalk Android x86-64 [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1925)
Crosswalk Android-X86 [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4875)

Copy link
Member

@rakuco rakuco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Member

@rakuco rakuco left a 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;
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

@crosswalk-trybot
Copy link

crosswalk-trybot commented Dec 1, 2016

Testing patch series with medic/crosswalk@e158f39 as its head.

Bot Status
Crosswalk Android-X86 [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4876)
Crosswalk Android x86-64 [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1926)
Crosswalk Linux [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4866)

@crosswalk-trybot
Copy link

crosswalk-trybot commented Dec 1, 2016

Testing patch series with medic/crosswalk@0a6f06e as its head.

Bot Status
Crosswalk Android-X86 [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4877)
Crosswalk Android x86-64 [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1927)
Crosswalk Linux [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4867)

@rakuco
Copy link
Member

rakuco commented Dec 1, 2016

Looking at the latest build error, I think you'll need to use a scoped_refptr here like the code in Chromium does: see ProfileImpl::GetExtensionSpecialStoragePolicy() in src/chrome, for example (the code basically remains the same, you just need to switch to a different smart pointer type).

@crosswalk-trybot
Copy link

crosswalk-trybot commented Dec 2, 2016

Testing patch series with medic/crosswalk@3d52973 as its head.

Bot Status
Crosswalk Android-X86 [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4878)
Crosswalk Android x86-64 [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1928)
Crosswalk Linux [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4868)

@@ -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_;
Copy link
Member

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.

@crosswalk-trybot
Copy link

crosswalk-trybot commented Dec 2, 2016

Testing patch series with medic/crosswalk@3ab2048 as its head.

Bot Status
Crosswalk Android-X86 [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4879)
Crosswalk Android x86-64 [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1929)
Crosswalk Linux [FAILED 💔](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4869)

@@ -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_;
Copy link
Member

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
@crosswalk-trybot
Copy link

crosswalk-trybot commented Dec 2, 2016

Testing patch series with medic/crosswalk@716cad2 as its head.

Bot Status
Crosswalk Android-X86 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android-X86/builds/4880)
Crosswalk Android x86-64 [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Android x86-64/builds/1930)
Crosswalk Linux [SUCCESS 💚](https://build.crosswalk-project.org/try/builders/Crosswalk Linux/builds/4870)

Copy link
Member

@rakuco rakuco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success at last!

@rakuco rakuco merged commit 45837ec into crosswalk-project:master Dec 2, 2016
@alxndrsn
Copy link
Contributor Author

alxndrsn commented Dec 2, 2016

Great! Thanks for your patience :¬)

@rakuco
Copy link
Member

rakuco commented Dec 2, 2016

@alxndrsn: there was just one Android test failure (unrelated to your change) reported in our Buildbots.

Suggestions:

  • Use git cherry-pick -x and cherry-pick your commit to the crosswalk-23 branch.
  • Once it lands, close XWALK-7413 and set the "Fix version/s" field accordingly.

@alxndrsn
Copy link
Contributor Author

alxndrsn commented Dec 2, 2016

@rakuco like this? #3961

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants