Bug 159255 - Purge PassRefPtr in Modules/webdatabase
Summary: Purge PassRefPtr in Modules/webdatabase
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gyuyoung Kim
URL:
Keywords:
Depends on: 159314
Blocks:
  Show dependency treegraph
 
Reported: 2016-06-29 02:07 PDT by Gyuyoung Kim
Modified: 2016-07-12 18:25 PDT (History)
7 users (show)

See Also:


Attachments
Patch (22.51 KB, patch)
2016-06-29 02:09 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (25.09 KB, patch)
2016-06-29 17:45 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch for landing (25.11 KB, patch)
2016-06-29 21:32 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (22.98 KB, patch)
2016-07-05 01:43 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gyuyoung Kim 2016-06-29 02:07:05 PDT
SSIA.
Comment 1 Gyuyoung Kim 2016-06-29 02:09:51 PDT
Created attachment 282334 [details]
Patch
Comment 2 Alex Christensen 2016-06-29 09:33:23 PDT
Comment on attachment 282334 [details]
Patch

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

> Source/WebCore/Modules/webdatabase/Database.cpp:249
> -        PassRefPtr<ScriptExecutionContext> passedContext = m_scriptExecutionContext.release();
> +        RefPtr<ScriptExecutionContext> passedContext = WTFMove(m_scriptExecutionContext);
>          passedContext->postTask({ScriptExecutionContext::Task::CleanupTask, [passedContext] (ScriptExecutionContext& context) {

c++14 allows you to do the WTFMove in the capture, like this:
passedContext = WTFMove(m_scriptExecutionContext)

> Source/WebCore/Modules/webdatabase/Database.h:128
> +    Database(RefPtr<DatabaseContext>&, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize);

RefPtr<DatabaseContext>&&
Comment 3 Gyuyoung Kim 2016-06-29 17:45:43 PDT
Created attachment 282394 [details]
Patch
Comment 4 Gyuyoung Kim 2016-06-29 18:18:37 PDT
(In reply to comment #2)
> Comment on attachment 282334 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=282334&action=review
> 
> > Source/WebCore/Modules/webdatabase/Database.cpp:249
> > -        PassRefPtr<ScriptExecutionContext> passedContext = m_scriptExecutionContext.release();
> > +        RefPtr<ScriptExecutionContext> passedContext = WTFMove(m_scriptExecutionContext);
> >          passedContext->postTask({ScriptExecutionContext::Task::CleanupTask, [passedContext] (ScriptExecutionContext& context) {
> 
> c++14 allows you to do the WTFMove in the capture, like this:
> passedContext = WTFMove(m_scriptExecutionContext)
> 
> > Source/WebCore/Modules/webdatabase/Database.h:128
> > +    Database(RefPtr<DatabaseContext>&, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize);
> 
> RefPtr<DatabaseContext>&&


I see. Fixed all. Thanks~
Comment 5 Benjamin Poulain 2016-06-29 20:32:23 PDT
Comment on attachment 282394 [details]
Patch

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

> Source/WebCore/Modules/webdatabase/SQLStatement.h:62
> +    RefPtr<SQLError> sqlError() const;
> +    SQLResultSet* sqlResultSet() const;

This is an inconsistent design.
Why is one returned by RefPTR and the other by pointer?

Please change this before landing unless you have a rationale.
Comment 6 Gyuyoung Kim 2016-06-29 21:32:19 PDT
Created attachment 282414 [details]
Patch for landing
Comment 7 Gyuyoung Kim 2016-06-29 21:37:17 PDT
(In reply to comment #5)
> Comment on attachment 282394 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=282394&action=review
> 
> > Source/WebCore/Modules/webdatabase/SQLStatement.h:62
> > +    RefPtr<SQLError> sqlError() const;
> > +    SQLResultSet* sqlResultSet() const;
> 
> This is an inconsistent design.
> Why is one returned by RefPTR and the other by pointer?
> 
> Please change this before landing unless you have a rationale.

I thought sqlError() was referenced by other variables. For example, 


void SQLTransactionBackend::openTransactionAndPreflight() {

...
 m_transactionError = m_wrapper->sqlError();

However it looks m_transactionError just calls member functions, not referenced or is passed to other variables. So it seems to me that sqlError() can be changed as well.
Comment 8 WebKit Commit Bot 2016-06-30 01:14:59 PDT
Comment on attachment 282414 [details]
Patch for landing

Clearing flags on attachment: 282414

Committed r202676: <http://trac.webkit.org/changeset/202676>
Comment 9 WebKit Commit Bot 2016-06-30 01:15:03 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Ryan Haddad 2016-06-30 13:17:59 PDT
This change appears to have caused storage/websql test crashes

See crashlogs from mac-wk1 here:
https://build.webkit.org/results/Apple%20El%20Capitan%20Debug%20WK1%20(Tests)/r202693%20(6322)/results.html
Comment 11 WebKit Commit Bot 2016-06-30 13:41:30 PDT
Re-opened since this is blocked by bug 159314
Comment 12 Gyuyoung Kim 2016-07-05 01:43:56 PDT
Created attachment 282758 [details]
Patch
Comment 13 Gyuyoung Kim 2016-07-05 01:47:07 PDT
Below lambda function caused the test crash on mac-wk1. However I don't know how to fix this issue yet. So I'd like to prepare a new patch after landing this patch. 

In Database.cpp,

Database::~Database()
{
...
        PassRefPtr<ScriptExecutionContext> passedContext = m_scriptExecutionContext.release();
        passedContext->postTask({ScriptExecutionContext::Task::CleanupTask, [passedContext] (ScriptExecutionContext& context) {
            ASSERT_UNUSED(context, &context == passedContext);
            RefPtr<ScriptExecutionContext> scriptExecutionContext(passedContext);
        }});
...
Comment 14 Gyuyoung Kim 2016-07-07 18:09:35 PDT
Ryan, Darin, could you take a look ? Last patch doesn't cause the test crash anymore.
Comment 15 WebKit Commit Bot 2016-07-12 18:25:08 PDT
Comment on attachment 282758 [details]
Patch

Clearing flags on attachment: 282758

Committed r203146: <http://trac.webkit.org/changeset/203146>
Comment 16 WebKit Commit Bot 2016-07-12 18:25:13 PDT
All reviewed patches have been landed.  Closing bug.