1926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)/*
2926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * Copyright (C) 2013 Apple Inc. All rights reserved.
3926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) *
4926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * Redistribution and use in source and binary forms, with or without
5926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * modification, are permitted provided that the following conditions
6926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * are met:
7926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * 1. Redistributions of source code must retain the above copyright
8926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) *    notice, this list of conditions and the following disclaimer.
9926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * 2. Redistributions in binary form must reproduce the above copyright
10926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) *    notice, this list of conditions and the following disclaimer in the
11926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) *    documentation and/or other materials provided with the distribution.
12926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) *
13926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2302772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) */
25926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
26926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)#include "config.h"
2753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "modules/webdatabase/SQLTransactionStateMachine.h"
28926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
291e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#include "platform/Logging.h"
3053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "wtf/Assertions.h"
31926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
32c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink {
33926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
34926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)#if !LOG_DISABLED
35926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)const char* nameForSQLTransactionState(SQLTransactionState state)
36926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){
37926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    switch (state) {
38926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::End:
39926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "end";
40926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::Idle:
41926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "idle";
42926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::AcquireLock:
43926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "acquireLock";
44926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::OpenTransactionAndPreflight:
45926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "openTransactionAndPreflight";
46926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::RunStatements:
47926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "runStatements";
48926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::PostflightAndCommit:
49926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "postflightAndCommit";
50926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::CleanupAndTerminate:
51926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "cleanupAndTerminate";
52926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::CleanupAfterTransactionErrorCallback:
53926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "cleanupAfterTransactionErrorCallback";
54926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::DeliverTransactionCallback:
55926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "deliverTransactionCallback";
56926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::DeliverTransactionErrorCallback:
57926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "deliverTransactionErrorCallback";
58926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::DeliverStatementCallback:
59926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "deliverStatementCallback";
60926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::DeliverQuotaIncreaseCallback:
61926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "deliverQuotaIncreaseCallback";
62926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    case SQLTransactionState::DeliverSuccessCallback:
63926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "deliverSuccessCallback";
64926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    default:
65926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return "UNKNOWN";
66926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    }
67926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)}
68926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)#endif
69926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
70c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink
71