OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "modules/webdatabase/SQLTransaction.h" | 43 #include "modules/webdatabase/SQLTransaction.h" |
44 #include "modules/webdatabase/SQLTransactionBackend.h" | 44 #include "modules/webdatabase/SQLTransactionBackend.h" |
45 #include "modules/webdatabase/SQLTransactionCallback.h" | 45 #include "modules/webdatabase/SQLTransactionCallback.h" |
46 #include "modules/webdatabase/SQLTransactionClient.h" | 46 #include "modules/webdatabase/SQLTransactionClient.h" |
47 #include "modules/webdatabase/SQLTransactionCoordinator.h" | 47 #include "modules/webdatabase/SQLTransactionCoordinator.h" |
48 #include "modules/webdatabase/SQLTransactionErrorCallback.h" | 48 #include "modules/webdatabase/SQLTransactionErrorCallback.h" |
49 #include "modules/webdatabase/sqlite/SQLiteStatement.h" | 49 #include "modules/webdatabase/sqlite/SQLiteStatement.h" |
50 #include "modules/webdatabase/sqlite/SQLiteTransaction.h" | 50 #include "modules/webdatabase/sqlite/SQLiteTransaction.h" |
51 #include "platform/Logging.h" | 51 #include "platform/Logging.h" |
52 #include "platform/heap/SafePoint.h" | 52 #include "platform/heap/SafePoint.h" |
53 #include "platform/weborigin/DatabaseIdentifier.h" | |
54 #include "public/platform/Platform.h" | 53 #include "public/platform/Platform.h" |
55 #include "public/platform/WebDatabaseObserver.h" | 54 #include "public/platform/WebDatabaseObserver.h" |
| 55 #include "public/platform/WebSecurityOrigin.h" |
56 #include "wtf/Atomics.h" | 56 #include "wtf/Atomics.h" |
57 #include "wtf/CurrentTime.h" | 57 #include "wtf/CurrentTime.h" |
58 | 58 |
59 // Registering "opened" databases with the DatabaseTracker | 59 // Registering "opened" databases with the DatabaseTracker |
60 // ======================================================= | 60 // ======================================================= |
61 // The DatabaseTracker maintains a list of databases that have been | 61 // The DatabaseTracker maintains a list of databases that have been |
62 // "opened" so that the client can call interrupt or delete on every database | 62 // "opened" so that the client can call interrupt or delete on every database |
63 // associated with a DatabaseContext. | 63 // associated with a DatabaseContext. |
64 // | 64 // |
65 // We will only call DatabaseTracker::addOpenDatabase() to add the database | 65 // We will only call DatabaseTracker::addOpenDatabase() to add the database |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 logErrorMessage(formatErrorMessage("error vacuuming database", resul
t, m_sqliteDatabase.lastErrorMsg())); | 705 logErrorMessage(formatErrorMessage("error vacuuming database", resul
t, m_sqliteDatabase.lastErrorMsg())); |
706 } | 706 } |
707 } | 707 } |
708 | 708 |
709 // These are used to generate histograms of errors seen with websql. | 709 // These are used to generate histograms of errors seen with websql. |
710 // See about:histograms in chromium. | 710 // See about:histograms in chromium. |
711 void Database::reportOpenDatabaseResult(int errorSite, int webSqlErrorCode, int
sqliteErrorCode, double duration) | 711 void Database::reportOpenDatabaseResult(int errorSite, int webSqlErrorCode, int
sqliteErrorCode, double duration) |
712 { | 712 { |
713 if (Platform::current()->databaseObserver()) { | 713 if (Platform::current()->databaseObserver()) { |
714 Platform::current()->databaseObserver()->reportOpenDatabaseResult( | 714 Platform::current()->databaseObserver()->reportOpenDatabaseResult( |
715 createDatabaseIdentifierFromSecurityOrigin(getSecurityOrigin()), | 715 WebSecurityOrigin(getSecurityOrigin()), |
716 stringIdentifier(), errorSite, webSqlErrorCode, sqliteErrorCode, | 716 stringIdentifier(), errorSite, webSqlErrorCode, sqliteErrorCode, |
717 duration); | 717 duration); |
718 } | 718 } |
719 } | 719 } |
720 | 720 |
721 void Database::reportChangeVersionResult(int errorSite, int webSqlErrorCode, int
sqliteErrorCode) | 721 void Database::reportChangeVersionResult(int errorSite, int webSqlErrorCode, int
sqliteErrorCode) |
722 { | 722 { |
723 if (Platform::current()->databaseObserver()) { | 723 if (Platform::current()->databaseObserver()) { |
724 Platform::current()->databaseObserver()->reportChangeVersionResult( | 724 Platform::current()->databaseObserver()->reportChangeVersionResult( |
725 createDatabaseIdentifierFromSecurityOrigin(getSecurityOrigin()), | 725 WebSecurityOrigin(getSecurityOrigin()), |
726 stringIdentifier(), errorSite, webSqlErrorCode, sqliteErrorCode); | 726 stringIdentifier(), errorSite, webSqlErrorCode, sqliteErrorCode); |
727 } | 727 } |
728 } | 728 } |
729 | 729 |
730 void Database::reportStartTransactionResult(int errorSite, int webSqlErrorCode,
int sqliteErrorCode) | 730 void Database::reportStartTransactionResult(int errorSite, int webSqlErrorCode,
int sqliteErrorCode) |
731 { | 731 { |
732 if (Platform::current()->databaseObserver()) { | 732 if (Platform::current()->databaseObserver()) { |
733 Platform::current()->databaseObserver()->reportStartTransactionResult( | 733 Platform::current()->databaseObserver()->reportStartTransactionResult( |
734 createDatabaseIdentifierFromSecurityOrigin(getSecurityOrigin()), | 734 WebSecurityOrigin(getSecurityOrigin()), |
735 stringIdentifier(), errorSite, webSqlErrorCode, sqliteErrorCode); | 735 stringIdentifier(), errorSite, webSqlErrorCode, sqliteErrorCode); |
736 } | 736 } |
737 } | 737 } |
738 | 738 |
739 void Database::reportCommitTransactionResult(int errorSite, int webSqlErrorCode,
int sqliteErrorCode) | 739 void Database::reportCommitTransactionResult(int errorSite, int webSqlErrorCode,
int sqliteErrorCode) |
740 { | 740 { |
741 if (Platform::current()->databaseObserver()) { | 741 if (Platform::current()->databaseObserver()) { |
742 Platform::current()->databaseObserver()->reportCommitTransactionResult( | 742 Platform::current()->databaseObserver()->reportCommitTransactionResult( |
743 createDatabaseIdentifierFromSecurityOrigin(getSecurityOrigin()), | 743 WebSecurityOrigin(getSecurityOrigin()), |
744 stringIdentifier(), errorSite, webSqlErrorCode, sqliteErrorCode); | 744 stringIdentifier(), errorSite, webSqlErrorCode, sqliteErrorCode); |
745 } | 745 } |
746 } | 746 } |
747 | 747 |
748 void Database::reportExecuteStatementResult(int errorSite, int webSqlErrorCode,
int sqliteErrorCode) | 748 void Database::reportExecuteStatementResult(int errorSite, int webSqlErrorCode,
int sqliteErrorCode) |
749 { | 749 { |
750 if (Platform::current()->databaseObserver()) { | 750 if (Platform::current()->databaseObserver()) { |
751 Platform::current()->databaseObserver()->reportExecuteStatementResult( | 751 Platform::current()->databaseObserver()->reportExecuteStatementResult( |
752 createDatabaseIdentifierFromSecurityOrigin(getSecurityOrigin()), | 752 WebSecurityOrigin(getSecurityOrigin()), |
753 stringIdentifier(), errorSite, webSqlErrorCode, sqliteErrorCode); | 753 stringIdentifier(), errorSite, webSqlErrorCode, sqliteErrorCode); |
754 } | 754 } |
755 } | 755 } |
756 | 756 |
757 void Database::reportVacuumDatabaseResult(int sqliteErrorCode) | 757 void Database::reportVacuumDatabaseResult(int sqliteErrorCode) |
758 { | 758 { |
759 if (Platform::current()->databaseObserver()) { | 759 if (Platform::current()->databaseObserver()) { |
760 Platform::current()->databaseObserver()->reportVacuumDatabaseResult( | 760 Platform::current()->databaseObserver()->reportVacuumDatabaseResult( |
761 createDatabaseIdentifierFromSecurityOrigin(getSecurityOrigin()), | 761 WebSecurityOrigin(getSecurityOrigin()), |
762 stringIdentifier(), sqliteErrorCode); | 762 stringIdentifier(), sqliteErrorCode); |
763 } | 763 } |
764 } | 764 } |
765 | 765 |
766 void Database::logErrorMessage(const String& message) | 766 void Database::logErrorMessage(const String& message) |
767 { | 767 { |
768 getExecutionContext()->addConsoleMessage(ConsoleMessage::create(StorageMessa
geSource, ErrorMessageLevel, message)); | 768 getExecutionContext()->addConsoleMessage(ConsoleMessage::create(StorageMessa
geSource, ErrorMessageLevel, message)); |
769 } | 769 } |
770 | 770 |
771 ExecutionContext* Database::getExecutionContext() const | 771 ExecutionContext* Database::getExecutionContext() const |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 return m_databaseThreadSecurityOrigin.get(); | 902 return m_databaseThreadSecurityOrigin.get(); |
903 return 0; | 903 return 0; |
904 } | 904 } |
905 | 905 |
906 bool Database::opened() | 906 bool Database::opened() |
907 { | 907 { |
908 return static_cast<bool>(acquireLoad(&m_opened)); | 908 return static_cast<bool>(acquireLoad(&m_opened)); |
909 } | 909 } |
910 | 910 |
911 } // namespace blink | 911 } // namespace blink |
OLD | NEW |